I have two questions with this code: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have two questions with this code:

void main{ int counter = 0; int registeredStudents [10]; while (counter < 10) { cout << "Student #" << counter + 1 << ":\n"; cin >> registeredStudents [counter]; counter++; } } 1. It won't let me use void for the main function. 2. The program allows me to give the first input for the array, but then just prints "Student #2:", "Student #3", etc. without letting me give more input. Thanks if you can give some answers!

26th Aug 2019, 4:13 PM
Thomas Wald
Thomas Wald - avatar
2 Answers
+ 2
1. for C++, must be int main(){ return 0; } 2. if you are using SoloLearn, input all input at separate lines before the app sends your codes back to their server for compilation. In computer, with IDE, the flow will be correct. Learn at computer with IDE.
26th Aug 2019, 4:16 PM
Gordon
Gordon - avatar
0
Gordon I was using a raspberry pi
26th Aug 2019, 8:27 PM
Thomas Wald
Thomas Wald - avatar