#include #include #include #include using namespace std; void setcolor(unsigned short color) //The function that you'll use to { //set the colour HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hcon,color); } int main() { short unsigned int score = 0; short unsigned int num = 0; short unsigned int num2 = 0; char letter; loop: srand(time(NULL)); //Initialize random number generator num = 1 + rand() % (6 - 1 + 1); num2 = 1 + rand() % (6 - 1 + 1); cout <<"\nPoints: "; setcolor (10); cout << score << endl; setcolor (7); cout <<"Get to 5 points to win. The numbers range between 1 and 6.\n"; setcolor (12); cout << num; setcolor (7); cout <<" is the first number. \nIs the next number going to be higher or lower? H or L?" << endl; cin >> letter; if (letter == 'h'||letter == 'H') { setcolor (12); cout << num2; setcolor (7); cout <<" is the second number."; if (num2>num) goto win; else if (num2num) goto lose; else if (num2==num) goto same; win: { if (score==4) { setcolor (12); cout <<" You completed the game! Well done!!!\n"; system ("pause"); return 0; } else {cout <<"You win! Well done!\n"; system ("pause"); score++; goto loop;} } same: {if (score==4) { setcolor (10); cout <<" You completed the game! Well done!!!\n"; system ("pause"); return 0;} else {cout <<"The numbers were the same! What a coincidence! I think\n we can give you a point for that..."; system ("pause"); score++; goto loop;}} lose: {cout <<"You lose...\n"; system ("pause"); }} return 0;}