+ 1
Why didn't my code compile??
3 Answers
+ 4
Line no 15:
cin>>mass[a]>>endl;
Don't use endl.
Change it to
cin>>mass[a];
+ 4
Павел Арзамасов
cin is an object of standard input stream.By default standard input stream is your keyboard.
cin is used with extraction operator >> . This operator is followed by the variable where extracted data is stored.
Example given cin>>mass[a] causes input extracted from input stream (keyboard) to get stored in variable mass[a] but endl is not a variable! and writing it after >> causes error.
When you want to create an newline after getting input use cout<<endl;
read:
http://www.cplusplus.com/doc/tutorial/basic_io/
+ 2
Why did endl prevent to compile??