Hi all.. If i knew this website existed it would have saved me hours of useless research!! Hi im David... first year programming. I was making this code and I keep getting the error "c:\documents and settings\david\my documents\pp2\real\real\real.cpp(26) : error C2143: syntax error : missing ';' before ')'" ........................................ This is the program I have made, the error is on like 26 but I don't know the reason for the error. Maby pros like you could help Code: #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { float n1, n2, hn, ln; //Defining variables LINE 10 printf("Insert first number = "); scanf("%f", &n1); printf("Insert second number = "); scanf("%f", &n2); if ( n1 > n2 ){ hn = n1; ln = n2; // LINE 20 } else { hn = n2; ln = n1; } for (ln < hn; ln++) { String formats = "%i %f %f\n"; StdOut.printf(ln, ln * ln, ln * ln * ln); } //LINE 30 system("pause"); return 0; }

The error is Code: for (ln < hn; ln++) and it should be Code: for (;ln < hn; ln++) but I see that you dont have ln initialized and so it should be something like Code: for (ln=0;ln < hn; ln++)

I tried that before in my original program and the same error appeared, I seriously don't know how it keeps failing... Lol, I asked my brother who also did programming and he was also puzzled on how it doesn't work.

You probably need to be working on "Hello World" program because I see you have written even the printf statement incorrect.

this is a new sem for me... last sem we were using the cin, cout approach... i just converted it into scanf() and printf()... thx, ill go through my work again and see how it is...

Scanf and printf are C functions. One can use them in C++, but writing C as C++ is a fool's mission. Don't bother. Anyone doing woodworking can measure with their forearm, mark with chalk, and cut with an axe. Anyone else may ask, "Why the hell would you do that? Masochisitic tendendies?"

Code: for (ln < hn; ln++) { String formats = "%i %f %f\n"; StdOut.printf(ln, ln * ln, ln * ln * ln); } //LINE 30 Replace the above coding with the followed one ,u will get answer Code: for (;ln < hn; ln++) { printf(" %f %f %f\n",ln, ln * ln, ln * ln * ln); } //LINE 30