Banking Transaction Code: Errors

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.

Here's the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <string>

using namespace 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";
	}
	else if (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.

Can someone help?
Last edited on
i am taking a wild guess that you are not using win32 console application.
and you have to end with return 0 in the main().
Well i am using win32 console application and it still doesn't work
closed account (z05DSL3A)
pract 2.obj : error LNK2005: _main already defined in pract1.obj

It looks like you have more than one file in this project and you have a main function defined in both of them.
yeah i think that was my problem
thanks ( I had another file in a project )
Topic archived. No new replies allowed.