Answer to Question #200999 in C++ for Master j

Question #200999

Identify the error/s in the following code below:

I) Main{ }

(

Cout<<"Name"

Cin>>name

)






1
Expert's answer
2021-06-01T03:00:55-0400
//The code is missing the header file iostream that enables us to work with cout and cin.
#include <iostream>
//we also need to use this namespace as it contains objects from the standard library
using namespace std;


int main() //The main function has to be declared as int, with () and not {}.
//"Main" should be in lowercase


{ //The body of the function should start with { and not );


char name[10]; //This variable was not declared and so could not be used


cout<<"Name"; //There was a missing semicolon and Cout should be in lowercase


cin>>name; //Missing semicolon and Cin should be in lowercase


return 0;//The return value of the function was missing


}//The body of the main function should be closed with } and not )

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