Why didn't my code compile?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
14th Sep 2019, 3:28 AM
Павел Арзамасов
Павел Арзамасов - avatar
3 Answers
+ 4
Line no 15: cin>>mass[a]>>endl; Don't use endl. Change it to cin>>mass[a];
14th Sep 2019, 3:41 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 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/
14th Sep 2019, 4:44 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Why did endl prevent to compile??
14th Sep 2019, 4:15 AM
Павел Арзамасов
Павел Арзамасов - avatar