> A question in c++ programming, help please?

A question in c++ programming, help please?

Posted at: 2014-12-18 
If you declare z after using it it will still be syntax error

also you forgot ";' after z = x + y

# include

int main ( ) {

int x=3;

int y=2;

z=x+y; // error z isn't declared before.

int z; // ok z declared now (but still the program won't compile, you have to declare it before using it)

std::cout << z;

return 0;

}

not a programmer but should there be a ";" after z=x+y

# include

int main ( ) {

int x=3;

int y=2;

z=x+y

cout << z;

return 0;

}

Now, this program is wrong because of the syntax error that is z is not defined, so what are the locations in this program that if I defined z in them, it would also be a syntax error ?