Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is wrong with my answer? It needs to be in C++ format and I\'m using the we

ID: 3718149 • Letter: W

Question

What is wrong with my answer? It needs to be in C++ format and I'm using the website vocareum to do this.

Here is the question:

Ask the user for an integer. If the number entered is greater than 50, then respond in a certain way, otherwise respond in another way.
For example:

and here is my answer:

#include <iostream>
#include <string?
using namespace std;

int main(){
//Declare a variable to take input int num;
//Prompt the user for input;
cout<" Enter a number: ";
cin>num;

return 0;
}

Explanation / Answer

ANSWER:- Given code segment is fully correct

#include <iostream>
#include <string> // first error in your code place of ">" oprater you use ?
using namespace std;

int main(){
int num;
cout<<" Enter a number: "; // second error use only single oprater < in your code
cin>>num;   // third error use only single oprater < in your code
if(num>50)
cout<<"you entered "<<num<<", which is greater than 50";
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote