Question
Print the following key and value from the following map shown in the following code in C++: #include #include #include #include #include using namespace std;
Print the following key and value from the following map shown in the following code in C++:
#include
#include
#include
#include
#include
using namespace std;
int main() {
srand(time(NULL));
cout << "Enter # of rows: ";
int row;
cin >> row;
cout << "Enter # of columns: ";
int column;
cin >> column;
vector
int startingIndex = 1;
for(int i = 0; i < row; i++){
vector
for(int j = 0; j < column; j++){
temp.push_back(startingIndex);
startingIndex++;
}
numberBoard.push_back(temp);
}
cout <<"Number Board:" << endl;
for(int i = 0; i < numberBoard.size(); i++){
for(int j = 0; j < numberBoard[i].size(); j++){
cout.width(5);
cout << numberBoard[i][j];
}
cout << endl;
}
vector
// looping through outer vector vec
for (int i = 0; i < row; i++) {
// looping through inner vector vec[i]
for (int j = 0; j < column; j++) {
int random = rand()% 32 + 65;
(hiddenBoard[i])[j] = char(random);
//i*n + j;
}
}
cout << " Board:" << endl;
for(int i = 0; i < hiddenBoard.size(); i++){
for(int j = 0; j < hiddenBoard[i].size(); j++){
cout.width(5);
cout << hiddenBoard[i][j];
}
cout << endl;
}
map
for(int i = 0; i < 20; i++){
boardMap[numberBoard[i]] = hiddenBoard[i];
}
return 0;
}
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