Answer to Question #270673 in C++ for DANISH

Question #270673
  • If diff is greater than or equal to 50, the program outputs the message indicating that the guess is very high (if guess is greater than num) or very low (if guess is less than num).
  • If diff is greater than or equal to 30 and less than 50, the program outputs the message indicating that the guess is high (if guess is greater than num) or low (if guess is less than num).
  • If diff is greater than or equal to 15 and less than 30, the program outputs the message indicating that the guess is moderately high (if guess is greater than num) or moderately low (if guess is less than num).
  • If diff is greater than 0 and less than 15, the program outputs the message indicating that the guess is somewhat high (if guess is greater than num) or somewhat low (if guess is less than num).
1
Expert's answer
2021-11-24T00:41:14-0500


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE




#include <iostream>
using namespace std;


int main() {
	
cout<<"\nEnter your guess: ";
int guess;
cin>>guess;
if(guess>= 50)
{
	cout<<"\nThe guess is very high."<<endl;
}
else if(guess>=30)
{
	cout<<"\nThe guess is high."<<endl;
}
else if(guess>=15 && guess < 30)
{
	cout<<"The guess is moderately high."<<endl;
}
else if(guess >= 0 && guess < 15)
{
	cout<<"\nThe guess is somewhat low"<<endl;
}
else
{
	cout<<"The guess is a negative number"<<endl;
}
    
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS