#include <iostream>
#include <cstdlib>
#include <time.h>
usingnamespace std;
int main()
{
char ans;
do
{
srand((unsigned)time(0));
int answer;
for (int i = 0; i < 1; i++)
{
answer = (rand()%100)+1;
}
//Rules of the game
cout << endl << "===========================================\n";
cout << " Guessing Game Rules\n";
cout << endl << "The program will simply generate 1 - 100\n";
cout << "randomly targeting 1 number for the player\n";
cout << " to try and guess the correct number.\n";
//Begin the game
cout << endl << "===========================================\n";
cout << endl << " Points\n";
cout << endl << "Try and guess the correct answer the least\n";
cout << "as you can to earn more points and a title!\n";
int count = 0;
int num;
int point = 100;
cout << endl << "The program has generated a number!\n";
cout << "What is the generated digit? ";
cin >> num;
//Calculate point + count
do
{
if (num > answer && count > 10)
{
point -= 5;
count += 1;
cout << endl << "That is not the right answer!\n";
cout << endl << "You have guessed too high! -5 pts\n";
cout << "What is the generated digit? ";
cin >> num;
}
elseif (num > answer && count > 10)
{
point -= 5;
count += 1;
cout << endl << "That is not the right answer!\n";
cout << endl << "You have guessed too low! -5 pts\n";
cout << "What is the generated digit? ";
cin >> num;
}
else
{
cout << "You have ran out of tires! Would you like to try again? (Y / N): ";
count = 0;
point = 0;
cin >> ans;
}
}
while (num == answer);
if (num == answer)
{
point -= count * 5;
cout << endl << "Congradulations! You have guessed the right number!\n";
cout << endl << "It took you " << count << " tries! Total Points: " << point;
}
//Titles
if (count >= 8 )
{
cout << endl << "Try improving your luck and come try again!\n";
}
elseif (count >= 6)
{
cout << endl << "You are very renowned!\n";
}
elseif (count >= 4)
{
cout << endl << "You are the guessing master!\n";
}
else
{
cout << endl << "You are now the god of prediction!\n";
}
cout << endl << "Would you like to continue? (Y / N): ";
cin >> ans;
}
while (ans == 'Y' || ans == 'y');
cout << endl << "Thanks for playing the guessing game! Good bye!\n";
}
Anyone knows what is going on? I have no errors that I see, and here is the log.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
1
1>Build started 5/23/2012 1:09:03 AM.
1>InitializeBuildStatus:
1> Touching "Debug\casign3-1.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>c:\users\enveus\documents\visual studio 2010\Projects\casign3-1\Debug\casign3-1.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.15
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
When you created this project, you told your IDE that you were making some kind of windows GUI project or whatever it calls it. That was a mistake. You meant to say it's just a plain console project.