Answered step by step
Verified Expert Solution
Question
1 Approved Answer
// Complete the code with the required instructions and execute // the program. Use the following values for rows and columns // to make sure
// Complete the code with the required instructions and execute
// the program. Use the following values for rows and columns
// to make sure the code works correctly:
// Program execution #1: 5 rows 3 columns
// Program execution #2: 3 rows 5 columns
// Program execution #3: 6 rows 6 columns
#include
using namespace std;
// use global variable for test purposes only
const int COLUMNS = ; // initilizes the constant
// function prototype declaration
void randomAssign(/* include the required parameters */);
void printArray(/* include the required parameters */);
void bubbleSort(/* include the required parameters */);
// the main function
int main() {
const int ROWS = ; // initializes the constant
// declare a two-dimensional integer array named twoDimInt
cout
// assign values to the array using the randomAssign method
cout
// print the values in the array using the printArray method
cout
// call the bubbleSort method to order the array
cout
// print the values in the array using the printArray method
// print the phrase
// "Program developed by [team member 1 name], ID#[team member 1 ID NUMBER HERE], and [team member 2 name], ID#[team member 2 ID NUMBER HERE]"
// where the square brackets must be replaced with your information
system("pause"); // for Visual Studio only
return 0;
}
// The randomAssign method assigns a value from 0 to 9999 to all elements
// in the array using the rand() method
void randomAssign(/* include the required parameters */) {
for (int i = 0; i
for (int j = 0; j
// write the instruction that assigns the values correctly
}
}
// print the array in a matrix format, with 5 spaces for each cell
void printArray(/* include the required parameters */) {
for (int i = 0; i
for (int j = 0; j
// write the correct instruction
}
// write the instruction so that each new row starts at the next line
}
// include a blank line after the array is printed
}
// Implements the Bubble Sort algorithm to sort the 2-dimensional array,
// ordering values from low to high across and then down
// Example: 1 2 3
// 4 5 6
void bubbleSort(/* include the required parameters */) {
// develop the logic to implement the bubble sort algorithm
// for a two-dimensional array
}
// the program. Use the following values for rows and columns
// to make sure the code works correctly:
// Program execution #1: 5 rows 3 columns
// Program execution #2: 3 rows 5 columns
// Program execution #3: 6 rows 6 columns
#include
using namespace std;
// use global variable for test purposes only
const int COLUMNS = ; // initilizes the constant
// function prototype declaration
void randomAssign(/* include the required parameters */);
void printArray(/* include the required parameters */);
void bubbleSort(/* include the required parameters */);
// the main function
int main() {
const int ROWS = ; // initializes the constant
// declare a two-dimensional integer array named twoDimInt
cout
// assign values to the array using the randomAssign method
cout
// print the values in the array using the printArray method
cout
// call the bubbleSort method to order the array
cout
// print the values in the array using the printArray method
// print the phrase
// "Program developed by [team member 1 name], ID#[team member 1 ID NUMBER HERE], and [team member 2 name], ID#[team member 2 ID NUMBER HERE]"
// where the square brackets must be replaced with your information
system("pause"); // for Visual Studio only
return 0;
}
// The randomAssign method assigns a value from 0 to 9999 to all elements
// in the array using the rand() method
void randomAssign(/* include the required parameters */) {
for (int i = 0; i
for (int j = 0; j
// write the instruction that assigns the values correctly
}
}
// print the array in a matrix format, with 5 spaces for each cell
void printArray(/* include the required parameters */) {
for (int i = 0; i
for (int j = 0; j
// write the correct instruction
}
// write the instruction so that each new row starts at the next line
}
// include a blank line after the array is printed
}
// Implements the Bubble Sort algorithm to sort the 2-dimensional array,
// ordering values from low to high across and then down
// Example: 1 2 3
// 4 5 6
void bubbleSort(/* include the required parameters */) {
// develop the logic to implement the bubble sort algorithm
// for a two-dimensional array
}
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