Why is it error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is it error?

#include <iostream> using namespace std; int main() { int Q1, Q2; cin >> Q1; cout << "PLEASE ENTER YOUR SECOND SCORE" << "\n"; cin>> Q2; cout << "\n"; int OutRange = {Q1 < 50 || Q2 < 50 || Q1 > 100 || Q2 > 100} "\n"; //OutRange means that the score is out of the range int withRange = (Q1 >= 50 && Q2 >= 50 || Q1 <= 100 && Q2 <= 100) "\n;" //withRange means that the score is within of the range cout <<"GENERATING RESULT... << "<<" \n": if (OutRange) { if (Q1 < 50 && Q2 < 50 || Q1 > 100 && Q2 > 100 || Q1 < 50 && Q2 > 100 || Q1 > 100 && Q2 < 50) { cout << "BOTH ARE INVALID"; } else if (Q1 < 50 || Q1 200) { cout << "Q1 1S INVALID"; } else if (Q2 < 50 || Q2 100) cout << "Q2 IS INVALID"; } else if (withRange) } cout<< "COMPUTING AVERAGE..." << "\n" ; return 0; }

5th Oct 2022, 6:43 AM
Leo
3 Answers
+ 1
Your code have so many error try to resolve one by one I have removed some of the errors i commented some of line you can modify it according to your need
5th Oct 2022, 6:59 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Please put C++ in post tags as the language relevant to the query https://code.sololearn.com/W3uiji9X28C1/?ref=app
5th Oct 2022, 10:48 AM
Ipang
0
#include <iostream> using namespace std; int main() { int Q1, Q2; cin >> Q1; cout << "PLEASE ENTER YOUR SECOND SCORE" << "\n"; cin>> Q2; cout << "\n"; int OutRange = (Q1 < 50 || Q2 < 50 || Q1 > 100 || Q2 > 100); //OutRange means that the score is out of the range // int withRange = (Q1 >= 50 && Q2 >= 50 )|| (Q1 <= 100 && Q2 <= 100); //withRange means that the score is within of the range cout <<"GENERATING RESULT... << "<<" \n"; if (OutRange) { if ((Q1 < 50 && Q2 < 50) || (Q1 > 100 && Q2 > 100) || (Q1 < 50 && Q2 > 100 )|| (Q1 > 100 && Q2 < 50)) { cout << "BOTH ARE INVALID"; } else if (Q1 < 50 || Q1 <200) { cout << "Q1 1S INVALID"; } else if (Q2 < 50 || Q2 <100) cout << "Q2 IS INVALID"; } else { cout<< "COMPUTING AVERAGE..." << "\n" ; } return 0; }
5th Oct 2022, 6:59 AM
A S Raghuvanshi
A S Raghuvanshi - avatar