Click here to Skip to main content
15,888,401 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: minimode(taskbar) in windows application Pin
Garth J Lancaster18-Jun-09 12:35
professionalGarth J Lancaster18-Jun-09 12:35 
GeneralRe: minimode(taskbar) in windows application Pin
samvaidy19-Jun-09 5:00
samvaidy19-Jun-09 5:00 
AnswerRe: minimode(taskbar) in windows application Pin
«_Superman_»18-Jun-09 19:07
professional«_Superman_»18-Jun-09 19:07 
GeneralRe: minimode(taskbar) in windows application Pin
samvaidy19-Jun-09 5:04
samvaidy19-Jun-09 5:04 
GeneralRe: minimode(taskbar) in windows application Pin
«_Superman_»19-Jun-09 16:35
professional«_Superman_»19-Jun-09 16:35 
Questionhelpm Pin
seiyfu yesuf18-Jun-09 10:59
seiyfu yesuf18-Jun-09 10:59 
AnswerRe: helpm Pin
Garth J Lancaster18-Jun-09 12:24
professionalGarth J Lancaster18-Jun-09 12:24 
Questionhelpm Pin
seiyfu yesuf18-Jun-09 10:56
seiyfu yesuf18-Jun-09 10:56 
Hi thier i have a little problem there is a c++ code but i am not directly change the code into c program becouse of in c++ code there are many code which are hard to change into c so pleas help me what y//#include<iostream.h>
#include<iomanip.h>
#include<fstream.h>
#include<stdlib.h>
#include<string.h>

using namespace std;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/**********************************************
* *
* ACCOUNT CLASS *
* *
**********************************************/
class Account
{

//protected:
public:
//data members

char Fname[20];
char Mname[20];
char Lname[20];
char nationality[20];
char occupation[20];
char tel_No[20];
char account_No[20];
float balance;


public:

//constructors and destructors
Account(); //default constructor
~Account(); //destructor


//member functions
char Press_Menu();
void Creat_Account();
void Display_Account();

};

///////////////////////////////////////////// END OF ACCOUNT CLASS /////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/**********************************************
* *
* CUSTOMER CLASS *
* *
**********************************************/


class Customer:public Account
{

private:

//data members
float rate;

public:

//constructors and destructors
Customer();
~Customer();

//member functions
float Current_Balance(){};
float Interest(){};
float Withdraw();
float Deposit();
};

////////////////////////////////////////////// END OF CUSTOMER CLASS ///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//constructor and destructor definition

Account::Account(){}; //default constructor

Account::~Account() //destructor
{
delete []Fname;
}
//END OF "Constructors and Destructor" definition of Account class
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//constructor and destructor definition

Customer::Customer(){}

Customer::~Customer()
{
delete []Fname;
}
//END OF "Constructors and Destructor" definition of Account class
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
char Account::Press_Menu()
{
char a=char(1000);

//INTERFACE DESIGN

char press;
cout<<"\n\n\t";
for(int i=0;i<61;i++)
printf("%c",a);
cout<<"\n\t";
cout<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5)<<"\n\t"
<<char(5)<<"\t\tWELL COME TO AMBESSA BANK\t\t "
<<char(5);
for(int i=0;i<2;i++)
{
cout<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5);
}
cout<<"\n\t"
<<char(5)<<"\tPRESS N ==>> TO CREAT NEW ACCOUNT\t\t "<<char(5)
<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5)

<<"\n\t"
<<char(5)<<"\tPRESS D ==>> TO DEPOSIT MONEY TO YOUR ACCOUNT\t "<<char(5)
<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5)

<<"\n\t"
<<char(5)<<"\tPRESS Q ==>> TO QUERY BALANCE OF EXISTING ACCOUNT "<<char(5)
<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5)

<<"\n\t"
<<char(5)<<"\tPRESS S ==>> TO DISPLAY ACCOUNT\t\t\t "<<char(5)
<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5)

<<"\n\t"
<<char(5)<<"\tPRESS W ==>> TO WITHDRAW MONEY FROM EXISTING ACCOUNT"<<char(5)
<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5)

<<"\n\t"
<<char(5)<<"\tPRESS X ==>> TO TERMINATE THE PROGRAM\t\t "<<char(5)
<<"\n\t"
<<char(5)
<<"\t\t\t\t\t\t\t "
<<char(5);

cout<<"\n\t";
for(int i=0;i<61;i++)
cout<<char(1000);

return press;
}
//END OF "Press_Menu"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Account::Creat_Account()
{

cin.get(); //to ignore input fromFname


//Interface design
cout<<"\n ";
for(int i=0;i<75;i++)
cout<<char(1000);
cout<<"\n ";
for(int i=0;i<70;i++)
cout<<char(15);
cout<<"\n ";
for(int i=0;i<64;i++)
cout<<char(1500);
cout<<"\n\n\t\t\tEnter Account Number:";
cin.getline(account_No,20);

ofstream out_file(account_No);

if(!out_file)
{
cout<<"\n\n\t\tError:File Not Found\n\n";
exit(1);
}

cout<<"\n\n\t ";
for(int i=0;i<55;i++)
cout<<char(15);
cout<<"\n\n\t\tFILL THE FOLLOWING INFORMATIONS\n\n\t ";

for(int i=0;i<55;i++)
cout<<char(15);
cout<<endl;

cout<<"\n\t\t\tFirst Name: ";
cin.getline(Fname,20);

cout<<"\n\t\t\tMiddle Name: ";
cin.getline(Mname,20);

cout<<"\n\t\t\tNationality: ";
cin.getline(nationality,20);

cout<<"\n\t\t\tOccupation: ";
cin.getline(occupation,20);

cout<<"\n\t\t\tTel. Number:";
cin.getline(tel_No,20);

A:cout<<"\n\t\t\tBalance: ";
cin>>balance;

//save data to the file
out_file<<balance<<endl;
out_file<<Fname<<endl;
out_file<<Mname<<endl;
out_file<<nationality<<endl;
out_file<<occupation<<endl;
out_file<<tel_No<<endl;

if(balance<50)
{
cout<<"\n\t\t\t\aInitial Minimum Balance is 50 birr !\n";
goto A;
}

//Interface design
cout<<endl<<endl<<"\t";
for(int i=0;i<60;i++)
cout<<char(16);
cout<<endl<<"\t";
for(int i=0;i<60;i++)
cout<<char(5);

cout<<"\n\n\t\tRemember !!! Your Account No. is "<<account_No;

//Interface design
cout<<endl<<endl<<"\t";
for(int i=0;i<60;i++)
cout<<char(5);
cout<<endl<<"\t";
for(int i=0;i<60;i++)
cout<<char(17);

cout<<"\n\n\n\t\t\tAccount "<<account_No<<" added to file\n\n";

out_file.close();

}
//END OF FUNCTION DEFINITION
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

float Customer::Deposit()
{

float amount;

cin.get();
cout<<" ";
for(int i=0;i<75;i++)
cout<<char(3500);
cout<<"\n ";
for(int i=0;i<70;i++)
cout<<char(1000);
cout<<"\n ";
for(int i=0;i<64;i++)
cout<<char(15);
D:cout<<"\n\n\t\t\tEnter Your Account Number:";
cin.getline(account_No,20);

ifstream in_file(account_No);

if(!in_file)
{
cout<<"\n\n\t\t\tError: File Not Found\n\n";
goto D;
}


//read data from the file
in_file>>balance;
in_file>>Fname;
in_file>>Mname;
in_file>>nationality;
in_file>>occupation;
in_file>>tel_No;

cout<<"\n\n\t\tYou Have a Balance of "<<balance<<" Birr";

cout<<"\n\n\t\tEnter the amount of money you want to Deposit:";
cin>>amount;
balance+=amount;

cout<<"\n\n\t\tYour Current Balance is "<<balance<<" Birr\n\n";

ofstream out_file(account_No);
out_file<<balance<<endl;
out_file.close();
in_file.close();
return balance;

}
//END OF FUNCTION DEFINITION
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
float Customer::Withdraw(){};

//END OF FUNCTION DEFINITION
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Account::Display_Account()
{
cin.get();
cout<<" ";
for(int i=0;i<75;i++)
cout<<char(1000);
cout<<"\n ";
for(int i=0;i<70;i++)
cout<<char(15);
cout<<"\n ";
for(int i=0;i<64;i++)
cout<<char(1000);
S:cout<<"\n\n\t\t\tEnter Your Account Number:";
cin.getline(account_No,20);

ifstream in_file(account_No);

if(!in_file)
{
cout<<"\n\n\t\t\tError: File Not Found\n\n";
goto S;
}


//Read data from the file
in_file>>account_No;
in_file>>Fname;
in_file>>Mname;
in_file>>nationality;
in_file>>occupation;
in_file>>tel_No;
in_file>>balance;

cout<<endl<<endl;
for(int i=0;i<80;i++)
cout<<char(1500);
cout<<endl;
cout<<setw(16)<<"Full"
<<setw(5)<<"Name"
<<setw(16)<<"Nationality"
<<setw(16)<<"occupation"
<<setw(13)<<"Tele.No"
<<setw(12)<<"Balance"<<endl<<endl;
for(int i=0;i<80;i++)
cout<<char(1500);
cout<<endl<<endl;


in_file.getline(account_No,20);

cout<<setw(11)<<Fname
<<setw(10)<<Mname
<<setw(16)<<nationality
<<setw(16)<<occupation
<<setw(13)<<tel_No
<<setw(12)<<balance
<<endl<<endl<<endl<<endl;

//save data to the file
ofstream out_file(account_No);
out_file<<account_No<<endl;
out_file<<Fname;
out_file<<Mname;
out_file<<nationality;
out_file<<occupation;
out_file<<tel_No;
out_file<<balance;

//close file
out_file.close();
in_file.close();
}
//END OF FUNCTION DEFINITION
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{

Account acc;
Customer c1;

char press;
char response;


//do selection
do
{
P:acc.Press_Menu();

cout<<"\n\n\t\tPRESS YOUR CHOICE:";
cin>>press;

switch(press)
{

case 'N': //CASE:1 Creat_Account
case 'n':
system("cls");
acc.Creat_Account();

N:cout<<endl<<"\t";
for(int i=0;i<60;i++)
cout<<char(3500);
cout<<"\n\t";
for(int i=0;i<60;i++)
cout<<char(1500);
cout<<"\n\n\t\tCONTINUE: YES (Press Y) NO (Press N):";
cin>>response;
//cout<<endl<<endl;
if(response=='Y'||response=='y')
{
system("cls");
goto P;
}
else if(response=='N'||response=='n')
{
X:system("cls");
cout<<"\n\n\n\n\n\t";
for(int i=0;i<60;i++)
cout<<char(3500);
cout<<"\n\t\t\t WELL DONE\n\t\t";
for(int i=0;i<40;i++)
cout<<char(15);
cout<<"\n\n\t\t\tTHANK YOU ! COME AGAIN !!!\n\n\t\t";
for(int i=0;i<40;i++)
cout<<char(15);
cout<<"\n\t\t\t END OF PROGRAMME\n\t";
for(int i=0;i<60;i++)
cout<<char(3500);
cout<<endl<<endl<<endl<<endl;
exit(1);
}
else
cout<<"\n\n\t\tInvalid Choice. Try Again"<<endl;
goto N;
break;


case 'D': //CASE:2 Deposit
case 'd':
system("cls");
c1.Deposit();
goto N;
break;

case 'Q': //CASE:3 Current_Balance
case 'q':
system("cls");
c1.Current_Balance();
goto N;
break;
case 'W': //CASE:4 Withdraw
case 'w':
system("cls");
c1.Withdraw();
goto N;
break;
case 'S': //CASE:5 Display_Account
case 's':
system("cls");
acc.Display_Account();
goto N;
break;

case 'X': //CASE:6 stop
case 'x':
goto X;
break;
default:
system("cls");
cout<<"\n\n\t\t\aInvalid choice. Try Again\a\n\n";
}
}

while(1);
return 0;
} //END OF "main"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ou can as much as possiple.
QuestionTrapping opening file dialog from javascript while using IWebBrowser2? Pin
Joe Woodbury18-Jun-09 6:44
professionalJoe Woodbury18-Jun-09 6:44 
AnswerRe: Trapping opening file dialog from javascript while using IWebBrowser2? Pin
Stuart Dootson18-Jun-09 8:07
professionalStuart Dootson18-Jun-09 8:07 
QuestionChanging the DialogSize Pin
p_196018-Jun-09 4:36
p_196018-Jun-09 4:36 
QuestionRe: Changing the DialogSize Pin
David Crow18-Jun-09 4:45
David Crow18-Jun-09 4:45 
AnswerRe: Changing the DialogSize Pin
p_196018-Jun-09 5:28
p_196018-Jun-09 5:28 
GeneralRe: Changing the DialogSize Pin
David Crow18-Jun-09 6:02
David Crow18-Jun-09 6:02 
AnswerRe: Changing the DialogSize Pin
Chris Losinger18-Jun-09 6:01
professionalChris Losinger18-Jun-09 6:01 
QuestionProblem at Wincore Pin
Software200718-Jun-09 4:32
Software200718-Jun-09 4:32 
AnswerRe: Problem at Wincore Pin
Stephen Hewitt18-Jun-09 5:07
Stephen Hewitt18-Jun-09 5:07 
GeneralRe: Problem at Wincore Pin
Software200718-Jun-09 5:19
Software200718-Jun-09 5:19 
QuestionSending HTML page as outlook body text Pin
charith8718-Jun-09 4:12
charith8718-Jun-09 4:12 
AnswerRe: Sending HTML page as outlook body text Pin
led mike18-Jun-09 4:21
led mike18-Jun-09 4:21 
GeneralRe: Sending HTML page as outlook body text Pin
charith8718-Jun-09 4:33
charith8718-Jun-09 4:33 
GeneralRe: Sending HTML page as outlook body text Pin
led mike18-Jun-09 4:56
led mike18-Jun-09 4:56 
GeneralRe: Sending HTML page as outlook body text Pin
charith8718-Jun-09 5:05
charith8718-Jun-09 5:05 
GeneralRe: Sending HTML page as outlook body text Pin
led mike18-Jun-09 5:26
led mike18-Jun-09 5:26 
GeneralRe: Sending HTML page as outlook body text Pin
charith8718-Jun-09 5:05
charith8718-Jun-09 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.