Hi I been trying for 2 hours trying to find the reason for these errors:
Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
Error 2 error LNK1120: 1 unresolved externals
It is on console setting and I checked for the subsystem and it is also set on console. I do not know what is wrong, also I am new to C++ so explain slowly (Please)
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int Range1, Range2, Guess, Midpoint, NumOfGuess;
string Selection;
bool GameQuit = false;
void MidpointReset()
{
Midpoint = rand() % 31 + 0;
Range1 = rand() % Midpoint + 0;
Range2 = rand() % 31 + Midpoint;
}
void RangeReset()
{
Range1 = rand() % Midpoint + Range1;
Range2 = rand() % Range2 + Midpoint;
}
int Main()
{
MidpointReset();
while (GameQuit == false)
{
cout << "1. Show me the range" << endl
<< "2. I want to guess the number" << endl
<< "3. Quit" << endl
<< "4. Reset MidPoint"
<< "Enter your selection :" << endl;
cin >> Selection;
if (Selection == string("1"))
{
cout << "Between " << Range1 << " and " << Range2 << endl;
RangeReset();
}
else if (Selection == string("2"))
{
cout << "Enter your guess:" << endl;
cin >> Guess;
NumOfGuess += 1;
if (Guess == Midpoint)
{
cout << endl << "Right! It took you " << NumOfGuess << " trials!";
GameQuit = true;
break;
}
}
else if (Selection == string("3"))
{
MidpointReset();
}
else if (Selection == string("4"))
{
cout << "Thanks for playing!";
GameQuit = true;
break;
}
else
{
cout << "Sorry " << Selection << "Is a invalid selection";
}
}
cout << "Please press any key to exit...";
_getch();
return 0;
}