Code:
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct database
{
int choice;
char crt[90];
char fstname[90];
char lstname[90];
char bd[90];
char mon[90];
char str[90];
char opn[90];
int x;
char data[1000];
char qui;
int c;
};
int main()
{
database input;
cout<<" Welcome to the new banking program \n";
cout<<"---------------------------------------------------------------------\n";
cout<<"Please choose from the below options:\n";
cout<<"1. Create a new account.\n";
cout<<"2. Open an existing account.\n";
cout<<"3. Information about the programmer.\n";
cout<<"4. Quit.\n";
cout<<"----\n";
cout<<"Your Choice: ";
cin>>input.choice;
cin.ignore();
cout<<" -------------------------------------------------------------\n";
if(input.choice==1)
{
cout<<"Please type in your account name: * please note u need to type .txt after the file name\n";
cin.getline(input.crt, 90);
cout<<"First name:\n";
cin.getline(input.fstname, 90);
cout<<"Last Name:\n";
cin.getline(input.lstname, 90);
cout<<"BirthDate\n";
cin.getline(input.bd, 90);
cout<<"Please type in the amount of money you want to deposit:\n";
cin.getline(input.mon, 90);
ofstream a_file(input.crt, ios::noreplace);
strcat(input.fstname, " ");
strcat(input.fstname, input.lstname);
a_file<<"Full name: " <<input.fstname <<"\n";
a_file<<"Birthdate: " <<input.bd <<"\n";
a_file<<"Amout of money: " <<input.mon;
a_file.close();
for(int x=0;x<101;x++)
{
cout<<input.x<<endl;
}
cout<<"The new account has been saved\n";
cout<<"--------- * ____________ * ---------\n";
main();
}
if(input.choice==2)
{
cout<<"Please Type the name of the account, note .txt must be included:\n";
cin.getline( input.opn, 90);
ifstream b_file(input.opn, ios::nocreate);
cout<<"\n";
for(int x=0;x<101;x++);
{
cout<<input.x<<endl;
}
cout<<input.opn <<"Opened, the data stored is:\n";
b_file.get(input.data, 1000);
cout<<input.data;
b_file.close();
}
if(input.choice==3)
{
cout<<"Information about the programmer:\n";
cout<<"---------------------------------\n";
cout<<"I am a beginner in programming totaly new to it, I found it alot injoyable and chalenging I was in Webdesigning only, but now I'm trying to get my interests to cover every single bit in the computers, thanks.\n";
cout<<"OK, now here is my profile:\n";
cout<<"Name: Shady M. Philip\n";
cout<<"Birthdate: 25/1/1988\n";
cout<<"Interests:\n";
cout<<" * Computers and Internet.\n";
cout<<" * Programming and webdesign.\n";
cout<<" * Goin' out.\n";
cout<<" * Movies.\n";
cout<<" * Songs.\n";
cout<<" * Chalenges.\n";
cout<<" * Having alot of friends.\n";
cout<<"Sorry there's not any way to contact me except if you find this program in a website you can post to it and contact me through there, Have fun.\n";
}
if(input.choice==4)
{
int quest()
{
database input
cout<<"Are you sure you want to Quit? y or n";
cin>>input.qui;
if(input.qui==y||yes)
{
cout<<"ByeBye";
for(int input.c=0;x<11;x++)
{
cout<<input.x;
}
return 0;
}
if(input.qui==n||no)
{
main();
}
else
{
cout<<"This is not an option\n";
quest();
}
}
}
}