i have write the bank system used C++ , but got the error , who can help me solve the error.
i use 3 file in this program:
1. bank.cpp
2. manager.h
3. bank.tcp (this file live it blank, save it as "bank.tcp" , this file is store the amount. )

#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
#include <fstream.h>
#include <stdlib.h>
#include <dir.h>


#include "Manager.h"
Account_Manager AM;


//These are all the functions used
void Deposit(int bal);
void Withdrawal(int bal);
void Balance(int bal);
void AccManager();
void Menu();
void FinOrganizer();
void Exit();


//These are the variables used
int Dnum;
int bal;
char select;



int main(){
//This function clears the screen everytime the program comes back to
//the main menu function.
//  clrscr();
//Main menu function
Menu();


return 0;
}
//The deposit function handles deposits coming into the program
void Deposit(){
clrscr();


cout <<"\n\tEnter an amount: $";
cin >>Dnum;


/*The balance is read from the Bank file and is added to the amount
deposited. When starting the program for the first time the bal will
be 0, but when a deposit amount is given, it is added to the bal so
the next time the bal is read from the Bank file it will be what
was added to the bal which was 0 and now the balance becomes the
first deposit and the process continues every time a deposit is made.*/


ifstream balin("Bank.tcd");
balin>>bal;
balin.close();


bal = bal + Dnum;


/*If someone tries to enter an amount which is valid like 0 the program
does not process it. Otherwise it adds it to the bal and displays the
amount deposited and also the new balance.*/


if(Dnum != 0){


ofstream Depo("Bank.tcd");
Depo<<bal;
Depo.close();


cout <<"\n\tAmount deposited: $"<<Dnum<<endl;
cout <<"\n\n\tYour balance is now: $"<<bal<<endl;


}else{
cout<<"\n\tIncorrect amount, try again."<<endl;
getch();
AccManager();


}


cout <<"\n\n\tPress any key to contine..."<<endl;
getch();
AccManager();


}
//The Withdrawal function is what it says it is. It withdraws any amount
//entered but will not minus the account.
void Withdrawal(){
clrscr();
int Wnum;



cout <<"\n\tEnter an amount: ";
cin >>Wnum;


if(Wnum != 0){
ifstream Without("Bank.tcd");
Without>>bal;
Without.close();


bal = bal - Wnum;


if(bal < 0){
cout <<"Your account can not be minus, please enter another amount."<<endl;
getch();
Withdrawal();
}


ofstream Within("Bank.tcd");
Within<<bal;
Within.close();


}
cout <<"\n\n\tAmount withdrewed: $"<<Wnum;
cout <<"\n\n\tYour balance is now: $"<<bal;


cout <<"\n\n\tPress any key to continue..."<<endl;
getch();
AccManager();
}


//The balance function displays what ever amount is in the Bank file
void Balance(){
clrscr();
bal;



ifstream Balout("Bank.tcd");
Balout>>bal;
Balout.close();


/*This "if" function compares the value of the bal integer and if
it contains this number 2408428 it sets it to 0. I did this because,
when I started writing this program the value of bal keep on reseting
to 2408428 which is the amount of an integer value on my
computer(yours maybe different). Though the problem is fixed now
I still use this test to make sure that it does not happen again. You
may want to change it because if someone enters an amount greater than
this number, yes, the program is going to reset the value of balance.*/


if(bal > 2408428){
bal = 0;
}
ofstream Balin("Bank.tcd");
Balin<<bal;
Balin.close();


cout <<"\n\tYour current balance is: "<<bal;
cout <<"\n\nPress any key to continue..."<<endl;
getch();
AccManager();
}


//This is the overall main menu list
void Menu(){
clrscr();


cout <<"\t\t\tMain Menu"<<endl;
cout <<"\t\t\t========="<<endl;


cout <<"\n\n\t1) Account Manager"<<endl;
cout <<"\n\t2) Finance Organizer"<<endl;
cout <<"\n\t3) Quit"<<endl;


cout <<"\n\n\tEnter selection: ";
cin >>select;


if(select == '1'){
AccManager();
}else{
if(select == '2'){
FinOrganizer();
}else{
if(select == '3'){
Exit();
}else{
Menu();
}
}
}


}


//This the main program list


void AccManager(){
clrscr();


cout <<"\t\t\tAccount Manager"<<endl;
cout <<"\t\t\t=============="<<endl;


cout <<"\n\n\t1) Make a Deposit"<<endl;
cout <<"\n\t2) Make a Withdrawal"<<endl;
cout <<"\n\t3) Check your Balance"<<endl;
cout <<"\n\t4) Main Menu"<<endl;
cout <<"\n\t5) Quit"<<endl;


cout <<"\n\n\tEnter your selection: ";
cin >>select;


if(select == '1'){
Deposit();
}else{
if(select == '2'){
Withdrawal();
}else{
if(select == '3'){
Balance();
}else{
if(select == '4'){
Menu();
}else{
if(select == '5'){
Menu();
}else{
AccManager();
}
}
}
}
}
}


void FinOrganizer(){
clrscr();
AM.Manager();


Menu();
}


void Exit(){
clrscr();
cout <<"\n\t\t\tProgram Comments"<<endl;
cout <<"\t\t\t---------------"<<endl;


cout <<"\n\n\tThis program was designed and writen by wongyingyuan,"<<endl;
cout <<"\tWriting this program was fun for me because"<<endl;
cout <<"\tthis is the first program that I personaly like since I began"<<endl;
cout <<"\tprograming in C++, which is not that long a go. "<<endl;



getch();
}


*end of this program, i save the upsite program in the file name "bank.cpp" .


------------------------------------------------------------------------


*this is a new file, i save it as "manager.h" .


class Account_Manager{


public:


void Manager(){  //Manager is the main program function because it
//controls access to all the other functions.


clrscr();


char select;


cout<<"\n\t\t\tFinance Organizer"<<endl;
cout<<"\n\t\t\t=============="<<endl;


cout<<"\n\n\tAdd Events(A)"<<endl;
cout<<"\n\tVeiw Events(V)"<<endl;
cout<<"\n\tDelete Events(D)"<<endl;
cout<<"\n\tPost Events(P)"<<endl;
cout<<"\n\tAbout Event Controller(I)"<<endl;
cout<<"\n\tQuit(Q)"<<endl;


cout<<"\n\n\tEnter selection: ";
cin>>select;


//This is a very straightforward if else statement.
//To activate any of the proceeding functions you have to type
//the corresponding letter eg (V --> View).


if((select == 'V')||(select == 'v')){
View();
}else{
if((select == 'A')||(select == 'a')){
Add();
}else{
if((select == 'P')||(select == 'p')){
Post();
}else{
if((select == 'Q')||(select == 'q')){


}else{
if((select == 'I')||(select == 'i')){
About();
}else{
if((select == 'D')||(select == 'd')){
Delete();
}else{
Manager();  //if a letter is typed that does not have a corresponding
//function the program loops back and refreshes the main
//menu.
} } } } } } }


int Add(){ //The Add function like the name describes adds new events
//to the program.


clrscr(); //this function clears the screen everytime the add
//function is activated.


//These are the variables that are used for entering information
//like the name, amount, post and balance.
char add;
char Event_Name[20];
int Event_Amount = 0;
int Event_Post = 0;
int Event_Balance = 0;


cout<<"\n\t\aEvent Name: ";
cin>>Event_Name; //Note add a name please don't leave any space between


cout<<"\n\tEvent Amount: ";
cin>>Event_Amount;


Event_Balance = Event_Amount; //Event_Balance equals Event_Amount
//because nothing has been posted yet, otherwise Event_Balance would
//contain the balance from the amount posted.



ofstream NameOut("Combine.cyl"); //This file was created in order to
//hold the name of the file thats going to hold the account information
//for instance the name of the Event you enter eg (phone bill)
//will become the name of the file (phonebill.txt)
//I don't know any other way to merge two separate text.
NameOut<<Event_Name<<".txt"<<endl;
NameOut.close();


char File[20];


ifstream NameIn("Combine.cyl");
NameIn>>File;    //the text already being join together is retrieved
//by the variable File as one word.
NameIn.close();


ofstream Out(File); //now it's being saved as a text file and the
//following information is being entered.
Out<<Event_Name<<endl;
Out<<Event_Amount<<endl;
Out<<Event_Post<<endl;
Out<<Event_Balance<<endl;
Out.close();


cout<<"\n\tDo you want to add another(y/n): ";
cin>>add;


if((add == 'y')||(add == 'Y')){
Add();
}else{
Manager();
}


}


void Post(){    //The Post function post the amount you entered for the event
//and gives you the balance as and saves that information back
//in the same file.
clrscr();
int E_Num;
int E_Amt;


cout<<"\n\t\t\t\aPost Events"<<endl;
cout<<"\t\t\t============"<<endl;


cout<<"\n\n #"<<"\t"<<"Event Name"<<"\t"<<"Event Amount"<<"\t"<<"Event Posted"<<"\t"<<"Event Balance"<<endl;
cout<<"======================================================================"<<endl;


File_Content(); //this function is described in more detail below.
//After the File_Content function is activated you're left
//with the content of all the files you've entered and by
//selecting an Event Number (1) and the amount you want to
//post (300) you're telling the program to post 300 for file 1.
cout<<"\n\tEnter an Event Number: ";
cin>>E_Num;


cout<<"\n\tEnter an Event Amount: ";
cin>>E_Amt;



char Event_Name[20];
int Event_Amount;
int Event_Post;
int Event_Balance;
int new_Balance;
char post;
char File_Name[20];


struct ffblk f;
char ff_name[26];
int count = 0;
//the findfirst() function finds all the txt files in the
//corrent folder
int done = findfirst("*.txt",&f,FA_HIDDEN);


while(!done){  //this while function loops brining up all the text file
//in the folder until there is no more.


count++;  //this is a counter that adds 1 every time a new file is found.


ifstream In(f.ff_name); //f.ff_name becomes the file name that the information
//is coming out of.
In>>Event_Name;
In>>Event_Amount;
In>>Event_Post;
In>>Event_Balance;
In.close();


done = findnext(&f);


if(count == E_Num){ //if the counted is equal to the number you first entered the loop will stop.


ofstream Out(f.ff_name);
Out<<Event_Name<<endl;
Out<<Event_Amount<<endl;
Out<<E_Amt<<endl;
new_Balance = Event_Balance - E_Amt;
Out<<new_Balance<<endl;
Out.close();


break;
}else{
continue;
}


}
cout<<"\n\n\tThe amount <"<<E_Amt<<"> has been posted to Event Number <"<<count<<">."<<endl;
cout<<"\n\tDo you want to post another(y/n): ";
cin>>post;


if((post == 'y')||(post == 'Y')){
Post();
}else{
Manager();
}
}



void View(){  //you will be able to view all the events you have entered


clrscr();


cout<<"\n\t\t\t\aView Events"<<endl;
cout<<"\t\t\t============"<<endl;


cout<<"\n\n #"<<"\t"<<"Event Name"<<"\t"<<"Event Amount"<<"\t"<<"Event Posted"<<"\t"<<"Event Balance"<<endl;
cout<<"======================================================================"<<endl;


File_Content();


cout<<"\n\tPress any key to go to the main menu...."<<endl;
getchar();
Manager();


}


private:


void File_Content(){ //File_Content is what brings up all the files that is in the
// current folder.
//Everything here was explaned in the post function


char Event_Name[20];
int Event_Amount = 0;
int Event_Post = 0;
int Event_Balance = 0;


struct ffblk f;
char ff_name[26];
int count = 0;


int done = findfirst("*.txt",&f,FA_HIDDEN);


while(!done){
count++;
ifstream In(f.ff_name);
In>>Event_Name;
In>>Event_Amount;
In>>Event_Post;
In>>Event_Balance;
In.close();


cout<<"\n "<<count<<setw(15)<<Event_Name<<setw(15)<<Event_Amount<<setw(15)<<Event_Post<<setw(15)<<Event_Balance<<endl;


done = findnext(&f);


} getchar();
}


void About(){
clrscr();
char opt;


cout<<"\n\t\t\t\aEvent Controller"<<endl;
cout<<"\t\t\t================"<<endl;


cout<<"\n\n\tHi, I’m wong"<<endl;


cout<<"\nDo you want to quit or return to main menu(q/m): ";
cin>>opt;


if(opt == 'q'){
exit(1);
}else{
Manager();
}



}


void Delete(){   //The Delete function is very important because after
//the full amount has been posted for an event you
//could delete to save space.


int E_Num;


clrscr();
cout<<"\n\t\t\t\aDelete Events"<<endl;
cout<<"\t\t\t============"<<endl;


cout<<"\n\n #"<<"\t"<<"Event Name"<<"\t"<<"Event Amount"<<"\t"<<"Event Posted"<<"\t"<<"Event Balance"<<endl;
cout<<"======================================================================"<<endl;


File_Content();


cout<<"\n\tEnter an Event Number: ";
cin>>E_Num;



char del;


struct ffblk f;
char ff_name[26];
int count = 0;


int done = findfirst("*.txt",&f,FA_HIDDEN);


while(!done){


count++;
ifstream In(f.ff_name);
In.close();


done = findnext(&f);


if(count == E_Num){


remove(f.ff_name);


break;
}else{
continue;
}


}


cout<<"\n\tDo you want to delete another(y/n): ";
cin>>del;


if((del == 'y')||(del == 'Y')){
Delete();
}else{
Manager();
}
}
};

Right away, I see that your main function is the first function. Try running the program with the main function last.

--
C++

sorry, i have try to run the program again, but it still have the error.
can u try to run this program and help me solve the error, thank you.

Mabye you should post the error too, easier to find the error then than going through the entire code.

Compiling BANK.CPP:
Warning MANAGER.H 154: Functions containing while are not expanded inline
Warning MANAGER.H 234: Functions containing while are not expanded inline
Warning MANAGER.H 309: Functions containing while are not expanded inline
Warning MANAGER.H 112: Functions containing missing return statements are not expanded inline in function Account_Manager::Add()
Warning MANAGER.H 133: Possible use of 'E_Num' before definition in function Account_Manager::Post()
Warning MANAGER.H 136: Possible use of 'E_Amt' before definition in function Account_Manager::Post()
Error MANAGER.H 152: Undefined symbol 'FA_HIDDEN' in function Account_Manager::Post()
Warning MANAGER.H 161: Possible use of 'Event_Name' before definition in function Account_Manager::Post()
Warning MANAGER.H 162: Possible use of 'Event_Amount' before definition in function Account_Manager::Post()
Warning MANAGER.H 163: Possible use of 'Event_Post' before definition in function Account_Manager::Post()
Warning MANAGER.H 164: Possible use of 'Event_Balance' before definition in function Account_Manager::Post()
Warning MANAGER.H 167: Possible use of 'f' before definition in function Account_Manager::Post()
Warning MANAGER.H 187: Possible use of 'post' before definition in function Account_Manager::Post()
Error MANAGER.H 212: Call to undefined function 'getchar' in function Account_Manager::View()
Error MANAGER.H 232: Undefined symbol 'FA_HIDDEN' in function Account_Manager::File_Content()
Error MANAGER.H 234: While statement missing ( in function Account_Manager::File_Content()
Warning MANAGER.H 298: Possible use of 'E_Num' before definition in function Account_Manager:: Delete()
Error MANAGER.H 307: Undefined symbol 'FA_HIDDEN' in function Account_Manager:: Delete()
Error MANAGER.H 309: While statement missing ( in function Account_Manager:: Delete()
Warning MANAGER.H 328: Possible use of 'del' before definition in function Account_Manager:: Delete()

Warning BANK.CPP 137: Constant is long in function Balance()
Warning BANK.CPP 137: Constant out of range in comparison in function Balance()

When I compiled this program in VC++, the only error I got was unexpected end of file

please let u sknow which program your using to compile it?

Well that wasn't worth waiting 3 YEARS for.

My compiler gives 4 errors, and those are from your header file(manager.h)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.