Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions