+ 1

Why does my code not work?

/* #include <iostream> using namespace std; int main() { int mark = 100; if (mark >= 50) { cout << "You passed." << endl; if (mark == 100) { cout <<"Perfect!" << endl; } } else { cout << "You failed." << endl; } return 0; } */ #include <iostream> using namespace std; int main() { int x; cout << "Please enter your exam score." << endl; cin >> x; if(x>=50) { cout << "Wow, you passed! Great Job!!" << endl; cout << "Be proud of a score of " << x << "!" << endl; if(x==100) { cout << "In fact, it couldn't be any higher!" << endl; } } else { cout << "Oops, it looks like you have failed!" >> endl; cout << "A score of " << x << " definitely means you can improve!" << endl; if(x==0) { cout << "In fact, did you even try?" << endl; } cout << "Better luck next time!" << endl; } return 0; }

29th Mar 2019, 12:22 AM
Vuko Han
Vuko Han - avatar
2 Antworten
+ 1
Thank you Biraj!
29th Mar 2019, 5:05 AM
Vuko Han
Vuko Han - avatar