+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; }

3/29/2019 12:22:08 AM

Vuko Han

2 Answers

New Answer

+6

In line no 42, you have used '>>' instead of '<<' before endl.

+1

Thank you Biraj!