Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Step 1: Write a program with two functions: InitArray() and PrintArray() . The p

ID: 3865027 • Letter: S

Question

Step 1: Write a program with two functions: InitArray() and PrintArray(). The program should create a 10 by 10 array of random integers (1 - 100) in  InitArray() and display the array in PrintArray(). (No global variables.)

Step 2: Create a bool function FindNumber() that accepts a number and returns its first location in the array.

Step 3: Add logic so that the user can guess a number and have the program return a message stating higher/lower for the x and y coordinates until they guess the number.

Bonus Step: Modify InitArray() so that no numbers are duplicated and change the logic so that the computer chooses the number and the user guesses the location.

Explanation / Answer

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

void initarray()
{
int array[10][10];
for(int i=0; i<10; i++){
for(int j=0;j<10;j++)
{
  
  
array[i][j] = (rand()%100)+1;

cout << array[i][j] << endl;
}
}
  
}


int main()
{
cout << "Hello World" << endl;
initarray();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote