Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- int matrix[10][10], vect[10], op[10];
- int n, m, value = 0;
- srand(time(0));
- cin >> n >> m;
- for(int i = 0; i < n; i++)
- for(int j = 0; j < m; j++)
- matrix[i][j] = rand() % 15;
- for(int i = 0; i < m; i++)
- vect[i] = rand() % 15;
- for(int i = 0; i < n; i++) {
- value = 0;
- for(int j = 0; j < m; j++)
- value += matrix[i][j] * vect[j];
- op[i] = value;
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++)
- cout << matrix[i][j] << " ";
- cout << endl;
- }
- cout << endl << endl << endl << endl;
- for(int i = 0; i < m; i++)
- cout << vect[i] << endl;
- cout << endl << endl << endl << endl;
- for(int i = 0; i < m; i++)
- cout << op[i] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement