-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomework.cpp
54 lines (53 loc) · 1.62 KB
/
homework.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
using namespace std;
int main()
{
double var[3][2] = {{5, 10}, {0.5, 1}, {0, 0.2}};
int len = sizeof(var) / sizeof(var[0]);
cout << len << endl;
int i;
int x;
double a;
double b;
for (i = 0; i < len + 1 ; i++)
{
cout << "loop number is " << i << endl <<endl <<endl <<endl;
if (i == 0) {
for (x = 0; x < len; x++) {
a = var[x][0];
b = var[x][1];
cout << "the eqesion is " << i << ", ";
cout << "the var number " << x << endl;
cout << "the results " << 5 * a + 5 * b << endl;
}
}
else if (i == 1) {
for (x = 0; x < len; x++) {
a = var[x][0];
b = var[x][1];
cout << "the eqesion is " << i << ", ";
cout << "the var number " << x << endl;
cout << "the results " << 2 * a + 2 * b << endl;
}
}
else if (i == 2) {
for (x = 0; x < len; x++) {
a = var[x][0];
b = var[x][1];
cout << "the eqesion is " << i << ", ";
cout << "the var number " << x << endl;
cout << "the results " << 2 * a + 5 * b << endl;
}
}
else
{
for (x = 0; x < len; x++) {
a = var[x][0];
b = var[x][1];
cout << "the eqesion is " << i << ", ";
cout << "the var number " << x << endl;
cout << "the results " << 5 * a + 2 *b << endl;
}
}
}
}