Commit 498c59e5 authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'ex7.9' into 'master'

exercise_07_09

See merge request bpcarm/trainings2017!1409
parents a1c6f0b6 ab5cb79e
a) int t[3][4]
b) 3
c) 4
d) 12
e) t[1][0], t[1][1], t[1][2], t[1][3]
f) t[0][2], t[1][2], t[2][2]
g) t[0][1] = 0,
h) t[0][0] = 0;
t[0][1] = 0;
t[0][2] = 0;
t[0][3] = 0;
t[1][0] = 0;
t[1][1] = 0;
t[1][2] = 0;
t[1][3] = 0;
t[2][0] = 0;
t[2][1] = 0;
t[2][2] = 0;
t[2][3] = 0;
i) for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j) {
a[i][j] = 0;
}
}
j) for(int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j) {
std::cin >> t[i][j];
}
}
k) int t[3][4] = {{9, 3, 4, 6}, {8, 9, 5, 1}, {6, 7, 3, 4}},min = t[0][0] ;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j) {
if (min > t[i][j]) {
min = t[i][j];
}
}
}
std::cout << min << std::endl;
l) for (int i = 0; i < 3; ++i) {
std::cout << a[0][i] << std::endl;
}
m) int sum = 0, t[3][4];
for (int i = 0; i < 3; ++i) {
sum += t[i][3];
}
}
n) int COLS = 4, ROWS = 3;
int t[ROWS][COLS] = {{1, 2, 3, 4}, {4, 5, 6, 7}, {7, 8, 9, 0}};
for (int j = 0; j < COLS; ++j) {
std::cout << "\t" << j;
}
std::cout << std::endl;
for (int i = 0; i < ROWS; ++i) {
std::cout << i << "\t";
for (int k = 0; k < COLS; ++k) {
std::cout << t[i][k] << "\t";
}
std::cout << std::endl;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment