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?
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;
}
+ 4
And to add to @Luigi answer, please, mind code indentation, it improves code readability, and structures the code neatly.
+ 2
Luigi you forgot std::endl in your code
+ 1
Thanks for your correction Tevin Charles 👍