Question: In c++ language, I need to change the integer array to char array or string array with the code below: A B C 101 102

In c++ language, I need to change the integer array to char array or string array with the code below:

A B C

101 102 103

104 105 106

X X X

to random shuffle

A B C

X 102 103

104 X 106

X 105 101

using namespace std;

void print(int** a){ cout<<" A B C"< for(int i = 0;i<3;i++){ cout<

int main() { int** a = new int*[3]; for(int i = 0; i < 3; ++i){ a[i] = new int[3]; } int num = 101; for(int i = 0;i<3;i++){ for(int j = 0;j<3;j++){ a[i][j] = num; num++; } } print(a); for(int i=3-1;i>=0;i--)

{

for(int j=3-1;j>=0;j--)

{

int k=rand()%3;

int l=rand()%3;

int t=a[i][j];

a[i][j]=a[l][k];

a[l][k]=t;

cout<

}

cout<<" ";

}

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!