@Петррр
6140 / 3440 / 338
Регистрация: 28.10.2010
Сообщений: 5,926
|
23.10.2011, 23:30
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| #include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(NULL));
setlocale(LC_ALL, "");
const int n = 5;
const int m = 6;
int a[n][m];
int sum[n] = { 0 };
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
{
a[i][j] = rand() % 10;
sum[i] += a[i][j];
}
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
cout.width(3);
cout << a[i][j];
}
cout << " Сумма строки: " << sum[i] << endl;
}
system("pause");
return 0;
} |
|
2
|