+ 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; }

23rd Nov 2017, 5:26 PM
Abdul Rahman
Abdul Rahman - avatar
3 Answers
+ 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
23rd Nov 2017, 5:33 PM
Ipang
+ 4
@Vadim, I missed the '=<', part, thanks for noting, fixed my answer :D
24th Nov 2017, 4:06 AM
Ipang
+ 2
1. '<=' instead '=<' 2. int main - without ' 3. x++;
24th Nov 2017, 12:26 AM
Š’Š°Š“ŠøŠ¼ Š”ухŠ¾Ń‚ŠøŠ½ (Vadim Sukhotin)
Š’Š°Š“ŠøŠ¼ Š”ухŠ¾Ń‚ŠøŠ½ (Vadim Sukhotin) - avatar