Question
I AM THRYING TO system( cls ); SO WHEN IT OUT THE ARRAY AND TAKE INPUT FROM USER IT WILL CLEAR SCREEN AND OUT THE
I 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started