Hey all, ive just started to learn C++ and this is my first post. Im making a simple program just to put together all that ive learned so far, but im getting the error:
Error C2447: '{' : Missing function header (old style formal list?)
Below is my code, thanks for any help in advance
Code:
#include <iostream>
using namespace std;
// This is my very first project, It has no real use, i dont even know what it is
// its just a simple program for me to mess around with what ive learned so far.
// By Michael Clarke 8/6/2007
int money = 100;
int total = 0;
int buy = 0;
int main();
{
// Money is used for how much money i have in pence.
// Total is something i will use later to help with the numbers.
// buy will be used for input from the user.
cout << "You have: " << money << endl;
cout << "Would you like to buy a coke for 75p?" << endl;
cout << "please press '1' for yes and '0' for no: ";
cin >> buy;
if buy == 1;
{
cout << "Thank you, That will be 75 Pence please" << endl;
money - 75;
}
if buy == 0;
{
cout << "Ok, Come again!" << endl;
}
else;
{
cout << "Please input a 0 for no or a 1 for yes" << endl;
}
cout << "thank you, have a nice day!" << endl;
cout << "You have: " << money << "in Change" << endl;
}