0
Try to figure out how to use while but something went WRONG
I use cppDroid #include <iostream> using namespace std; int num = 0; while (num < 20) { cout << "Number: " << num << endl; num++; } The output is /buildSources/while.cpp:5:1: error:expected unqualified_id before 'while' while (num < 20){ ^ Return code is not 0 Can someone help me?
8 Respostas
+ 2
// So it's true that we need to do everything here huh.
#include <iostream>
using namespace std;
int main() {
int num = 0;
while (num < 20) {
cout << "Number: " << num++ << endl;
}
}
+ 3
Your main function is missing.
+ 2
really thankful for spending time on my question,can't be more appreciate
+ 1
thank you guys,i will give it a try
+ 1
silencer 45
Or you might consider a reverse solution besides your original approach as
//...
int main() {
int num = 20;
while (num--)
cout << num << endl;
}
Output :
19
18
.
.
.
1
0
0
I guess that's because you forgot int main()
0
sorry guys,but nope
0
i tried int main() and down below is
int num = 0;
only int main()
and pops out
except initializer before while