Does anyone know why I'm getting this error when linking this program. It compiles OK, just fails when linking:
error LNK2001: unresolved external symbol _WinMain@16
Here's the program I'm working on:
//A simple game of guess the number
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <cstdlib>
#include <iomanip>
#include <ctime>
int main()
{
int num, guess=0;
char play='y';
srand (time(0));
while (play='y'){
num= rand() % 1000;
cout<< num;
cout<<"I have a number between 1 and 1000.\n";
cout<<"Can you guess my number? \n";
cout<<"Please type your first guess.\n";
cin>>guess;
while (guess != num){
if( guess > num){
cout<<"Too high. Try again.";
}
else {
cout<<"Too low. Try again.";
}
cin>> guess;
}
cout<<"Excellent! You guessed the number!\n";
cout<<"Would you like to play again(y or n)\n";
cin>> play;
}
return 0;
}
[sig][/sig]
error LNK2001: unresolved external symbol _WinMain@16
Here's the program I'm working on:
//A simple game of guess the number
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <cstdlib>
#include <iomanip>
#include <ctime>
int main()
{
int num, guess=0;
char play='y';
srand (time(0));
while (play='y'){
num= rand() % 1000;
cout<< num;
cout<<"I have a number between 1 and 1000.\n";
cout<<"Can you guess my number? \n";
cout<<"Please type your first guess.\n";
cin>>guess;
while (guess != num){
if( guess > num){
cout<<"Too high. Try again.";
}
else {
cout<<"Too low. Try again.";
}
cin>> guess;
}
cout<<"Excellent! You guessed the number!\n";
cout<<"Would you like to play again(y or n)\n";
cin>> play;
}
return 0;
}
[sig][/sig]