Hi-Lo Program

I need help creating a program that has the user start with a 1,000 points, and asks the user how much of those points they want to risk and to choose High or Low. The computer then chooses a number between 1 and 13. If the number is between 1 and 6 it is considered low, 8-13 is considered High, 7 is considered neither High or Low and the user would then loose the points at risk. Here is the code I have so far:

#include <iostream>
#include <ctime>
using namespace std;

int range()
{
return(rand()%14+1);
}

int main()
{
srand(static_cast<unsigned int>(time(0)));
int score=1000;
int risk;
char answer;
int prediction;
do{
cout<<"You have "<<score<<" points."<<endl;
cout<<"Points to risk: ";
cin>>risk;
cout<<"Predict (1=High, 0=Low): ";
cin>>prediction;
int num=range();
cout<<"Would you like to play again? y/n";
cin>>answer;
}while (answer=='y');
return(0);
}
Last edited on
Topic archived. No new replies allowed.