Can anyone tell me why this code isnt working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell me why this code isnt working?

#include <iostream> using namespace std; int main() { int yourScore; cout << " Please input your score\n"; cin << yourScore; if (yourScore >69) { cout << " you passed.\n"; } else { cout << " you failed.\n"; } return 0; } I'm very new at this and i can't seem to figure this out. Every time I run it the console says compiler error.

12th Nov 2016, 9:14 PM
zack
3 Answers
+ 4
check your cin the arrows should point into the variable cin >> yourScore; when in doubt, ask yourself: do i need to put data into (>>) or get the data from (<<)
12th Nov 2016, 9:18 PM
Burey
Burey - avatar
0
Chage cin << yourScore to cin >> yourScore
12th Nov 2016, 9:19 PM
Lynda May
Lynda May - avatar
0
Because after cin you have use << instead it use >>...
12th Nov 2016, 10:31 PM
ROHAN JOSHI
ROHAN JOSHI - avatar