program wont compile..why?
i did a code similar to one posted on here not too long ago. i only get 2 errors but i cant figure out how to fix them.
heres the code--
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
class account
{
public:
int deposit(int deposit);
int withdrawal(int withdrawal);
void getbalance(void);
private:
int balance;
};
int account::deposit(int deposit)
{
cout<<"How much would you like to deposit?"<<endl;
cin>>deposit;
int balance = balance + deposit;
cout<<"Thank you. Your balance is now "<<balance;
return balance;
}
int account::withdrawal(int withdrawal)
{
cout<<"How much would you like to withdraw?"<<endl;
cin>>withdrawal;
int balance = balance - withdrawal;
cout<<"Thank you. Your balance is now "<<balance<<
return balance;
}
void getbalance(void)
{
cout<<"Your balance is currently "<<balance;
}
int main()
{
cout<<"What would you like to do with your account?"<<endl;
cout<<"1. deposit"<<endl;
cout<<"2. withdraw"<<endl;
cout<<"3. view balance"<<endl;
cout<<"4. cancel"<<endl;
int Iaccount;
cin>>Iaccount;
if(Iaccount == 1)
deposit(int deposit)
if(Iaccount == 2)
withdrawal(int withdrawal)
if(Iaccount == 3)
getbalance(void)
if(Iaccount == 4)
{
cout<<"Please come again."<<endl;
}
system("PAUSE");
return 0;
}
i may have made a couple typos in here but its all correct in the code. the only 2 errors i get are a parse error before ')' on line 48
Code:
deposit(int deposit)
it looks the same as all the other if statements to me...
and the other error is--"confused by earlier errors, bailing out" on line 56(the closing } after the 4th if statement).
can anyone tell me why these are happening and how to fix it?