Super Beginner Needs Help

As I said, I'm just learning programming and I cannot find out what is wrong with this code.

These are the errors it gives me.

1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Computer\Documents\Visual Studio 2012\Projects\ConsoleApplication4\Debug\ConsoleApplication4.exe : fatal error LNK1120: 1 unresolved externals

And here is the actual code.

//Header file
#include <iostream> //Required if your program does any I/O. PART A OF PROBLEM
#include <string> //Required if your program uses a sequence of characters PART A OF PROBLEM

using namespace std; //Required for ANSI C++ 1998 standard. PART B OF PROBLEM

int main ()
// Named constants
string name; // PART C OF PROBLEM
double studyHours; // PART C OF PROBLEM

cout << "Hello, what is your name? "<< endl; //ALL PART D OF PROBLEM
cin >> name >> endl; //ALL PART D OF PROBLEM
cout << "How much do you need to study? " << endl; //ALL PART D OF PROBLEM
cin >> studyHours >> endl; //ALL PART D OF PROBLEM
cout << name << "You need to study " << studyHours << "for the exam." << endl; //ALL PART D OF PROBLEM

char reply;

// This section stops the program 'flashing' off the screen.
cout << "Press q (or any other key) followed by 'Enter' to quit: ";
cin >> reply;

return 0;

Don't do this:

cin >> name >> endl;

do cin >> name;
Last edited on
Topic archived. No new replies allowed.