Youre a professor for CS 1 at the local community college C

You\'re a professor for CS 1 at the local community college C++ and one of your students comes up to you about a program they are writing. They ward to write a game that will cheek if the user wants to continue to play a guessing game. They\'ve writes the code part below. Is it correct? Yes or no? If no, strikeout the code and rewrite it to the right of the statements. string userValue = cout userNum;} else {count

Solution

Q25) Yes. The code is correct. Below is the code I tested:

#include <iostream>
using namespace std;
int main()
{
   string userValue = \"\";
   cout<<\"Enter true or false.\"<<endl;
   cin>>userValue;  
  
   int userNum=0;
   if(userValue==\"true\")
   {
       cout<<\"Enter a number between one and ten\"<<endl;
       cin>>userNum;
   }
   else
   {
       cout<<\"Game over\";
   }
   return 0;
}

Q26) (x<5)?(z=-1*y):(y=x);

 You\'re a professor for CS 1 at the local community college C++ and one of your students comes up to you about a program they are writing. They ward to write a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site