i came up with this and it works but i would like it not to close when the user enters the wrong number but i dont know how to get it to restart
i made it in C++ express 2008
// Include the iostream library
#include <iostream>
//Use the standard namespace
usingnamespace std;
void main()
{
// Declare the variables
int secretNumber = 4;
int Dog = 0;
int Number = 1;
int Cow = 2;
int Sheep = 3;
int Apple = 5;
int Car = 6;
int Pizza = 7;
int Pig = 8;
int Horse = 9;
int userguess;
// Give instructions
cout << "Hello can you guess My favorite number?" << endl;
//Input from user:
cin >> userguess;
//Print The Result
if (userguess == secretNumber)
{
cout << "That is amazingly correct!"<<endl;
}
if (userguess == Dog)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Pig)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Number)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Horse)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Car)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Cow)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Apple)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Pizza)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
if (userguess == Sheep)
{
cout << "That is Not My Favorite Number Guess Again Next Time"<<endl;
}
system ("Pause");
}