Code: Select all
/* This is my second ever program made by memory and trial and error.
Created by PinPoint on 22/11/2010 after a few hours learning C++ */
#include <iostream>
#include <cstdio>
using namespace std;
int main ()
{
int number;
int guess;
number = (423);
cout << "Press enter to Play My Game...\n";
getchar();
cout << "Guess the number equal to or higher\n"
<< "than 0 and equal to or smaller than\n"
<< "1000 and you will get a surprise\n\n";
cout << "I think the number is = ";
cin >> guess;
getchar();
restart1:
if (guess==number)
{
cout << "\n\nYOU'RE AWSOME!!!!!\n\n";
getchar();
cout <<"Goodbye and thanks for playing.\n";
}
else if (guess<number)
{
cout << "\n\nYou're guess is lower\n\n\tI think the number is = ";
cin >> guess;
goto restart1;
getchar();
}
else if (guess>number)
{
cout << "\n\nYou're guess is higher\n\n\tI think the number is = ";
cin >> guess;
goto restart1;
getchar();
}
getchar();
return 0;
}