Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I AM THRYING TO system( cls ); SO WHEN IT OUT THE ARRAY AND TAKE INPUT FROM USER IT WILL CLEAR SCREEN AND OUT THE

image text in transcribedI AM THRYING TO system("cls"); SO WHEN IT OUT THE ARRAY AND TAKE INPUT FROM USER IT WILL CLEAR SCREEN AND OUT THE ANOTHER ARRAY IN SAME SO WHERE WOULD I USE system("cls"); in this code plz help.. c++

#include

#include

#include

#include

using namespace std;

int main() {

char option;

int score = 0;

cout

cout

cout

cout

cout

cout

cin >> option;

if (option == 'K' || option == 'k'){

cout

cout

cout

cout

cout

cin >> option;

}

if (option =='L' || option =='l'){

cout

cout

cout

cin >> option;

}

if (option == 'y' || option == 'Y'){

cout

cout

cout

cout

cout

cout

cin >> option;

}

if (option =='L' || option =='l'){

cout

cout

cout

cin >> option;

}

if (option == 'y' || option == 'Y'){

cout

cout

cout

cout

cout

cout

cin >> option;

}

if (option == 'K' || option == 'k'){

cout

cout

cout

cout

cout

cin >> option;

}

if (option == 'y' || option == 'Y'){

cout

cout

cout

cout

cout

cout

cin >> option;

}

if (option == 'K' || option == 'k'){

cout

cout

cout

cout

cout

cin >> option;

}

if (option =='L' || option =='l'){

cout

cout

cout

cin >> option;

}

if (option == 'y' || option == 'Y'){

cout

cout

cout

cout

cout

cout

cin >> option;

}

if (option == 'P' || option == 'p'){

cout

cout

}

if (option =='p' || option =='P'){

char myArray[2][2]={{'O','O'},{'O','*'}};

char choice;

while(true) {

srand(time(NULL));

int x, y;

char temp;

for (int i=0;i

for (int j=0;j

x = rand() % 2;

y = rand() % 2;

temp = myArray[i][j];

myArray[i][j] = myArray[x][y];

myArray[x][y] = temp;

}

}

cout

for (int i=0;i

for (int j=0;j

{

cout

}

cout

}

cout

cin >> choice;

if ((choice == 'Q' && myArray[0][0] == '*') || (choice == 'W' && myArray[0][1] == '*') || (choice == 'A' && myArray[1][0] == '*') || (choice == 'S' && myArray[1][1] == '*')) {

score += 1;

}

if ((choice != 'Q' && myArray[0][0] == '*') || (choice != 'W' && myArray[0][1] == '*') || (choice != 'A' && myArray[1][0] == '*') || (choice != 'S' && myArray[1][1] == '*')) {

cout

break;

}

if (score ==20){

cout

cout

cout

break;

}

cout

cout

}

cout

cout

Welcome to whack-A-Mole game Press K for controls: Press P to play the game: Press L for direction: : P Game starts in 10 sec Be sure to have the cap lock on 0 * Whack a mole: S Your SCORE IS: 1/20: The hitting ratio is:5 0 * Whack a mole: S Your SCORE IS: 2/20: The hitting ratio is:10 * 0 Whack a mole: Program ended with exit code: 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago