How do i make this work? It is supposed to to let you insert two variables (a name and score) and print the mark. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do i make this work? It is supposed to to let you insert two variables (a name and score) and print the mark.

#include <iostream> using namespace std; int main() { int name,score; int standard=50; cin >> name; cin >> score; cout << "The performance of" << name << "is:" << score << endl; if(score>=standard){ cout << "Pass" << endl;} if(score==100){ cout << "Perfect"; } else{ cout << "Fail"; } return 0; }

2nd Jun 2019, 6:24 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar
4 Answers
+ 1
Agreed with Choe , <name> should be using string. And to add a little, for score decision you can use `else if` too ... if(score >= standard) { if(score == 100) { cout << "Perfect" << endl; } else { cout << "Pass" << endl; } } else { cout << "Fail" << endl; }
2nd Jun 2019, 10:15 PM
Ipang
+ 2
name is an int. We cant have names like that 😄 #include <string> string name;
2nd Jun 2019, 8:12 PM
Choe
Choe - avatar
+ 1
Use new lines to separate multiple inputs. Alice 42
2nd Jun 2019, 6:30 PM
Diego
Diego - avatar
0
But it doesn't work. It just says compilation error
2nd Jun 2019, 7:46 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar