Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- #include "ctime"
- #include "cstdlib"
- using namespace std;
- int ms[10][10];
- int n,m,d,i,g;
- int main()
- {
- srand(time(0));
- cout << "Please input the value for M and N: ";
- cin >> m >> n;
- cout << "Please input the value for D: ";
- cin >> d;
- cout << endl;
- cout << "There is a Matrix N*M: ";
- cout << endl;
- //generate matrix
- for (i = 0; i < m; i++)
- {
- for (g = 0; g < n; g++)
- {
- ms[i][g] = rand() % 100;
- }
- }
- //printing the output of matrix
- for (i = 0; i < m; i++)
- {
- for (g = 0; g < n; g++)
- {
- cout << ms[i][g] << " ";
- }
- cout << endl;
- }
- //printing the output of D col
- cout << endl << "There is a D colom: " << endl;
- for (i = 0; i < m; i++)
- {
- cout << ms[i][d-1] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement