|
From: Carlos d. M. <cg...@wo...> - 2002-08-06 12:18:11
|
It shall work if it compiles. But when I declare i like you, inside a
for statement, the compiler reports error due to an old fashioned way to
declare it, try to declare it before the for. But then that error should
have been reported.
Or substitute it by a while, and perhaps after you can restore the for
and see what happens.
On one of my recent experiments I first used a for, the program didn't
run and I changed it by a while, and it worked (???????), after I used
again the for and it worked (??????????!!!!!!!!!!!!!!).
Some times the compiler behaves a little strange, it pass over lines
don't executing them, or calls functions which are not called where it
calls them, or makes a for or while not work although it is well
written...
tam...@ms... escribi=F3:
> I have been tasked with a problem in my newbie manual to use a "for
> loop" and to console out by 2's from 0 to 20 here's what I have done
> and I was wondering 1st why it doesn't work and 2nd how do I make it
> work. #include <iostream>int main()
> {
> // --- iterate an integer by 2
> for (int i =3D 0; i <=3D 20; i+=3D2){
> std::cout << i << '\n';
>
> }
> // --- pause system
> char end[5];
> std::cin >> end; return 0;
> } Thanks in advanceDanny
>
|