View Full Version : [Question(s)] simple code not working

01-18-2011, 05:10 PM
basically I have just started out in c++ programming. I purchased a book and have been doing tutorials. I was wondering if anyone could help me get this program to compile.

using namespace std

int main(void)
int NumberX = 0
int NumberY = 0
int Numberz = 0
int FinalNumber = 0

cout <<"please enter 3 numbers: " << endl;
cin >> NumberX;
cin >> NumberY;
cin >> NumberZ;

FinalNumber = NumberX + NumberY - NumberZ;

cout <<" all my hard work finally: " << FinalNumber << endl;

system ("pause");
return 0;

01-18-2011, 05:13 PM
It helps if you also post the errors (so we have a hint as to what is not compiling).


01-18-2011, 05:33 PM
sorry about that the int main(void) would not work.

I got rid fo the int main(void) and used simple int main() but still not workign I'll try to post a screenshot.


01-18-2011, 05:49 PM
Answer is in the debugging window (found at the bottom of your screen): "expected ',' or ';' before cout"

You're missing a semi-colon at the end of line 11.

You also mis-typed "numberZ" as "numberz" in line 10, hence "numberZ" is undeclared when you use it in line 14.