Answer to Question #191176 in C++ for python

Question #191176

1. Write a C++ program that will create 2D array using random numbers and then show these values.


1
Expert's answer
2021-05-14T18:21:11-0400
#include <iostream>
#include <time.h>


using namespace std;


int main()
{
    srand(time(NULL));


    int twoDimensionalArray[3][4];
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 4; j++)
            twoDimensionalArray[i][j] = rand()%101;
    }


    cout << endl;
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 4; j++)
            cout << twoDimensionalArray[i][j] << " ";
        cout << endl;
    }


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog