I'm pretty begginer at c++ but i've started to make a code which i need help in.
I'm trying to make a simple banking transaction where you can deposit or withdraw money.
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
char choice;
int result;
int c;
c = 300;
cout<<"You have "<< c << "in you account";
cout<<"Do you want to withdraw ( Withdraw = Y )or deposit ( Deposit = N )";
cin >> choice;
if (choice == 'Y') { //Withdraw
int a;
cout<<"How much money that you want to withdraw: \n";
cin >> a;
result = a - c;
cout<<"You have "<< result << "in your acc. \n";
}
elseif (choice == 'N') { //Deposit
int b;
cout<<"How much money that you want to deposit: \n";
cin >> b;
result = b + c;
cout<<"You have "<< result << "in your acc. \n";
}
else {
cout<<"Invalid";
}
cin.get();
}
I get this error saying:
1>pract 2.obj : error LNK2005: _main already defined in pract1.obj
and
1>C:\Documents and Settings\Metalnos\My Documents\Visual Studio 2008\Projects\practice\Debug\practice.exe : fatal error LNK1169: one or more multiply defined symbols found.