Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int matrix[10][10], vect[10], op[10];
  9. int n, m, value = 0;
  10. srand(time(0));
  11. cin >> n >> m;
  12. for(int i = 0; i < n; i++)
  13. for(int j = 0; j < m; j++)
  14. matrix[i][j] = rand() % 15;
  15. for(int i = 0; i < m; i++)
  16. vect[i] = rand() % 15;
  17. for(int i = 0; i < n; i++) {
  18. value = 0;
  19. for(int j = 0; j < m; j++)
  20. value += matrix[i][j] * vect[j];
  21. op[i] = value;
  22. }
  23. for(int i = 0; i < n; i++) {
  24. for(int j = 0; j < m; j++)
  25. cout << matrix[i][j] << " ";
  26. cout << endl;
  27. }
  28. cout << endl << endl << endl << endl;
  29. for(int i = 0; i < m; i++)
  30. cout << vect[i] << endl;
  31. cout << endl << endl << endl << endl;
  32. for(int i = 0; i < m; i++)
  33. cout << op[i] << endl;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement