+ 1

can someone explain whats wrong si that for loop dosent work?

https://code.sololearn.com/cSfRh97OkJuv/?ref=app

17th Nov 2019, 3:42 AM
mohsin khan
mohsin khan - avatar
2 Answers
+ 4
you should put int x; and the function in main() which you have already close before definition of the function, and the for loop needs a condition not an assignment https://code.sololearn.com/cCU0PjrOD9q3/?ref=app
17th Nov 2019, 4:00 AM
✳AsterisK✳
✳AsterisK✳ - avatar
0
#include <iostream> //Function declaration void printSomething(); int main() { for(int x=0;x=10;x++){ printSomething(); } } //Function definition void printSomething() { cout << "Hi there!"; } u cant use for lop out of function
17th Nov 2019, 10:59 PM
Eotd Pro
Eotd Pro - avatar