whatsapp

Connect on Whatsapp : +1 206 673 2541, Get Homework Help 24x7, 100% Confidential. Connect Now

Write a function | Computer Science homework help

Create following functions, and test use given main function.

int** create2DArray(int row, int column): return a 2d dynamic int array with given row

and column.

void populate(int** array, int row, int column, int start): initialize the given dynamic

2d array use number from start, and increase one every element.

void print(int** array, int row, int column): print every element from given dynamic 2d

array.

void delete2DArray(int** array, int row, int column): which delete given dynamic 2d

array from the heap.

Use pointer arithmetic for every function.

Use following main() to test your class.

int main(){

int **a = create2DArray(3,5);

populate(a,3,5,10);

print(a,3,5);

delete2DArray(a,3,5);

cout<<endl;

a = create2DArray(2,6);

populate(a,2,6,22);

print(a,2,6);

delete2DArray(a,2,6);

}

Output from given main function:

10 11 12 13 14

15 16 17 18 19

20 21 22 23 24

22 23 24 25 26 27

28 29 30 31 32 33

5. Q5: Write a function for given main function

void bargraph(int n)

which takes an integer n and print the bar graph based on the digit of given integer.

Use pointer arithmetic and Dynamic Array if you would like to use array.

Use following main() to test your class.

int main(){

bargraph(12945);

bargraph(6789102);

}

Output from given main function:

X

X

X

X

X X

X X X

X X X

X X X X

X X X X X

———-

1 2 9 4 5

X

X X

X X X

X X X X

X X X X

X X X X

X X X X

X X X X X

X X X X X X

————–

6 7 8 9 1 0 2

Answer:

Get FREE Essay Price Quote
Pages (550 words)
Approximate price: -