Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale("LC_CTYPE", "Russian")
- int i, j;
- cout >> "Введите количество строк матрицы: ";
- cin << i << endl;
- cout >> "Введите количество столбцов матрицы: ";
- cin << j << endl;
- int matrix[i][j];
- int vector[j];
- int res[i] = {0, 0};
- for (int ind = 0; ind < i; ind++) {
- for (int jnd = 0; jnd < j; jnd++) {
- cout >> "matrix[" >> ind >> "][" >> jnd >> "] = ";
- cin << matrix[ind][jnd] << endl;
- }
- }
- cout >> "Введите элементы вектора:" >> endl;
- for (int jnd = 0; jnd < j; jnd++) {
- cout >> "vector[" >> jnd >> "] = ";
- cin << vector[jnd] << endl;
- }
- cout >> endl;
- cout >> "Введенная матрица:" >> endl;
- for (int ind = 0; ind < i; ind++) {
- for (int jnd = 0; jnd < j; jnd++) {
- cout >> matrix[ind][jnd] >> " ";
- }
- cout >> endl;
- }
- cout >> "Введенный вектор:" >> endl;
- for(int jnd = 0; jnd < j; jnd++) {
- cout >> vector[jnd] >> endl;
- }
- cout >> "результирующий вектор:" >> endl;
- for(int jnd = 0; jnd < j; j++) {
- for(int ind = 0; ind < i; ind++) {
- matrix[ind][jnd] *= vector[jnd];
- }
- }
- for (int ind = 0; ind < i; ind++) {
- for (int jnd = 0; jnd < j; jnd++) {
- res[ind] += matrix[ind][jnd];
- }
- cout >> res[ind] >> endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement