here is what i fixed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#include <iostream>
#include <ctime> // for time functions
#include <cstdlib> //for rand and srand functions
using namespace std;
void random();
void welcome();
void guessing();
void check();
int main;
{
int Number = 0;
int guess = 0;
srand(time(0));
number = rand() % 99 + 1;
cout << number << endl << endl;
}
void welcome()
{
cout << "welcome to the guessing game" << endl;
}
int guessing(int guess)
{
cout << "I thinking of a number between 1 and 100. Guess the number";
cin >> guess;
}
int check(int guess, int secretNumber)
{
while (guess != secretNumber){
if(!(cin >> guess)){
cout << "Sorry, must be a number" << endl;
cin.clear();
cin.ignore(256, '\n');
continue;
}
if(guess < 0 || guess > 100) {
cout << "Sorry, guess between 1 and 100" << endl;
cin.clear();
cin.ignore(256, '\n');
continue;
}
if (guess > secretNumber) {
cout << "Too high!\n\n";
}else if (guess < secretNumber) {
cout << "Too low!\n\n";
}else {
cout << "Congratulations, you got it!\n\n";
}
}
}
void random()
{
cout << "good game!!!" << endl;
system("pause");
return 0;
}
|
1>------ Build started: Project: secretnumber, Configuration: Debug Win32 ------
1>Compiling...
1>asd.cpp
1>c:\users\baret academic\documents\visual studio 2008\projects\secretnumber\secretnumber\asd.cpp(9) : error C2144: syntax error : 'int' should be preceded by ';'
1>c:\users\baret academic\documents\visual studio 2008\projects\secretnumber\secretnumber\asd.cpp(16) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>dfsg.cpp
1>c:\users\baret academic\documents\visual studio 2008\projects\secretnumber\secretnumber\dfsg.cpp(12) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\baret academic\documents\visual studio 2008\projects\secretnumber\secretnumber\dfsg.cpp(61) : error C2562: 'random' : 'void' function returning a value
1> c:\users\baret academic\documents\visual studio 2008\projects\secretnumber\secretnumber\dfsg.cpp(6) : see declaration of 'random'
1>Generating Code...
1>Build log was saved at "file://c:\Users\Baret Academic\Documents\Visual Studio 2008\Projects\secretnumber\secretnumber\Debug\BuildLog.htm"
1>secretnumber - 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========