+ 1
What is wrong with this program?
#include<iostream> using namespace std; 'int main()' { int x=0; while (x=<2) { cout<<"is"<<x<<end1; x++ } return 0; }
3 ответов
+ 9
Here you go, I added comments under each line where you made mistake, keep learning and don't give up :)
#include <iostream>
using namespace std;
int main()
// was 'int main()' you don't need the single quotes
{
int x=0;
while (x<=2) {
// was while(x=<2), operator <= (less than or equal to)
cout<<"is"<<x<<endl;
//endl (lowercase L) not end1
x++;
// missing semicolon
}
return 0;
}
Hth, cmiiw
+ 4
@Vadim, I missed the '=<', part, thanks for noting, fixed my answer :D
+ 2
1. '<=' instead '=<'
2. int main - without '
3. x++;