Rest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working. // Use function to display menu, and display game rules, // Use different color for text display. // fix it so it works any way you like. /* HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7); */ #include #include using namespace std; int main() { //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<> ch1; switch (ch1) { case 1: //system("cls"); cout << " General Description"<> ch2; if (ch2 == '*') { ch2 = '#'; goto C; } else goto D; break; case 2: //system("cls"); cout << "Enter Your Name : "; cin >> a; for (int i = 0; i <= 100; i += 20) { cout << "Loading " << i < 0) system("cls"); randomize(); rnum = random(num); cout << " Enter Your Guess : "; cin >> guess; count = 8; B: while (guess != rnum) { count--; if (guess > rnum) { cout << guess << " is High….!!!! " << " Now You Have "<< count <<" chance left "<> guess; goto B; } if (guess < rnum) { cout << guess << " is Low…!!! "<< " Now You Have " << count << " chance left"<> guess; goto B;
Rest of code in image
/ This is a bad programming style since it is using goto.
// This is an spagetti code and not working.
// Use function to display menu, and display game rules,
// Use different color for text display.
// fix it so it works any way you like.
/*
HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);
// Write 16 lines in 16 different colors.
for (int color = 0; color < 16; color++)
{
SetConsoleTextAttribute (screen, color);
cout << " Hello World!" << endl;
Sleep(400); // Pause between lines to watch them appear
}
// Restore the normal text color)
SetConsoleTextAttribute(screen, 7);
*/
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
//textbackground(WHITE);
//textcolor(RED);
system("cls");
char ch, a[20], ch2;
int num = 100, rnum, guess, count, ch1, c = 0;
cout << "**********************************************************"<<endl;
cout << "* Welcome To High / Low Game *" << endl;
cout << "**********************************************************" << endl;
cout << " Main Menu " <<endl;
cout << " 1. Rules " << endl;
cout << " 2. Play " << endl;
cout << " 3. Exit " << endl;
cout<< " Enter your choice(1 - 3) : " << endl;
cin >> ch1;
switch (ch1)
{ case 1: //system("cls");
cout << " General Description"<<endl;
cout << " The Computer picks a random number from 0 to 99.n You must try to guess the number."<<endl;
cout << " The Computer ask you to enter your guess.You have 8 chances to guess the number."<<endl;
cout << " The computer checks the number, if your guess isn less than computer’s numer than " << endl;
cout<< " it will show a messagen that your guess is lowand ask for higher number."<<endl;
cout << " If your guess is higher than the computer’s numbern than computer will show" << endl;
cout << " a message that your guess is high andn ask for lower number."<<endl;
cout << " If your guess is equal to the computer’s number, thann computer" << endl;
cout << " will print a message congratulating younand will ask you to play the game again or exit."<<endl;
cout << " If you are unable to guess the number than the computern " << endl;
cout << " will a sorry message and ask you to play the game again or exit."<<endl;
//D: cout << “nnn Press * to goto Main Menu : ”;
//cin >> ch2;
if (ch2 == '*')
{ ch2 = '#';
goto C;
}
else
goto D;
break;
case 2: //system("cls");
cout << "Enter Your Name : ";
cin >> a;
for (int i = 0; i <= 100; i += 20)
{ cout << "Loading " << i <<endl;
Sleep(100);
}
cout << "Hi "<< a << " !!!!";
A: if (c > 0)
system("cls");
randomize();
rnum = random(num);
cout << " Enter Your Guess : ";
cin >> guess;
count = 8;
B: while (guess != rnum)
{ count--;
if (guess > rnum)
{
cout << guess << " is High….!!!! " << " Now You Have "<< count <<" chance left "<<endl;
if (count == 0)
break;
cout << " Enter Your Guess Again : ";
cin >> guess;
goto B;
}
if (guess < rnum)
{
cout << guess << " is Low…!!! "<< " Now You Have " << count << " chance left"<<endl;
if (count == 0)
break;
cout << " Enter Your Guess Again : " <<endl;
cin >> guess;
goto B;
![break,
goto B;
}
}
if (guess == rnum)
cout <<" Congratulation " << a << " You Have Done IT...!lla"<<endl;
switch (count)
{ case 7: cout <<" Your Score is 100 out of 100"<<endl;
break;
6: cout <<" Your Score is 85 out of 100" << endl;
case
5: cout <<" Your Score is 70 out of 100" << endl;
break;
case 4: cout <<"Your Score is 55 out of 100" << endl;
break;
case 3: cout <<" Your Score is 40 out of 100" << endl:
break;
case 2: cout <<" Your Score is 25 out of 100" << endl:
break;
case 1: cout<<" Your Score is 100 out of 100 " << endl:
break;
}
}
else
{
cout << " Sorry " << a<<" Bad Luck...!!Try Next Time "<<endl;
cout << " Want to Play More(y / n) :"<<endl;
cin >> ch:
if (ch == 'y' || ch == 'Y')
{
goto A;
else
{
cout<<" Thank you for participating "<<endl;
Sleep(10000);
exit();
}
break;
case 3: { cout << "==:
cout << "= Thank you for participating
cout << "===:
Sleep(10000);
exit();
=="<<endl;
=" << endl;
<<endl;
}
system("pause");
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2c30b2c3-62fe-421c-b864-63a8dde6d2d9%2Fb72a28f2-c00f-4e30-9241-a7a041db2ce1%2Fy44x0e_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)