Commit 77408e1e authored by Believer Programmers' Club's avatar Believer Programmers' Club

Merge branch 'exercise_05_11' into 'master'

Mary Zaqaryan Exercise_05_11 Version1

See merge request bpcarm/trainings2017!1355
parents 5e3183af 242a006a
#include <iostream>
int
main()
{
std::cout << "Year " << "Deposit amount\n";
for (int rate = 5; rate <= 10; ++rate) {
std::cout << rate << "% Rate:\n";
double principal = 1000.0;
double rateIncrement = 1 + rate / 100.0;
for (int year = 1; year <= 10; ++year) {
principal *= rateIncrement;
std::cout << year << " " << principal << "\n";
}
std::cout << std::endl;
}
}
exercise_05_11: exercise_05_11.o | .gitignore
g++ $^ -o $@
exercise_05_11.ii: exercise_05_11.cpp
g++ -E $^ -o $@
exercise_05_11.s: exercise_05_11.ii
g++ -S $^ -o $@
exercise_05_11.o: exercise_05_11.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_11" > $@
removes:
rm *.ii *.s *.o *.out exercise_05_11 .gitignore
test: exercise_05_11
./exercise_05_11 > test.out
diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
Year Deposit amount
5% Rate:
1 1050
2 1102.5
3 1157.62
4 1215.51
5 1276.28
6 1340.1
7 1407.1
8 1477.46
9 1551.33
10 1628.89
6% Rate:
1 1060
2 1123.6
3 1191.02
4 1262.48
5 1338.23
6 1418.52
7 1503.63
8 1593.85
9 1689.48
10 1790.85
7% Rate:
1 1070
2 1144.9
3 1225.04
4 1310.8
5 1402.55
6 1500.73
7 1605.78
8 1718.19
9 1838.46
10 1967.15
8% Rate:
1 1080
2 1166.4
3 1259.71
4 1360.49
5 1469.33
6 1586.87
7 1713.82
8 1850.93
9 1999
10 2158.92
9% Rate:
1 1090
2 1188.1
3 1295.03
4 1411.58
5 1538.62
6 1677.1
7 1828.04
8 1992.56
9 2171.89
10 2367.36
10% Rate:
1 1100
2 1210
3 1331
4 1464.1
5 1610.51
6 1771.56
7 1948.72
8 2143.59
9 2357.95
10 2593.74
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