0

#include <iostream> using namespace std; int main; { int a=2; do { cout <<a<<endl; a++; } while(a<985); return 0; }

what is wrong in this statement?

18th Apr 2018, 8:00 AM
Adarsh Thakur
Adarsh Thakur - avatar
4 Respostas
+ 2
//the main function must be followed by () in order to work. /* PS: never ever use "using namespace std;", just use "std::cout <<a<<endl; a++;" when recalling an std method. This will save your life in bigger projects, so just avoid it :) */ #include <iostream> int main() { int a=2; do { std::cout <<a<<std::endl; a++; } while (a < 985); return 0; }
18th Apr 2018, 8:11 AM
Luigi
Luigi - avatar
+ 4
And to add to @Luigi answer, please, mind code indentation, it improves code readability, and structures the code neatly.
18th Apr 2018, 8:16 AM
Ipang
+ 2
Luigi you forgot std::endl in your code
24th Jul 2018, 5:21 PM
Tevin Charles
Tevin Charles - avatar
+ 1
Thanks for your correction Tevin Charles 👍
24th Jul 2018, 5:26 PM
Luigi
Luigi - avatar