Commit c8c85893 authored by Believer Programmers' Club's avatar Believer Programmers' Club

Merge branch 'branch5.29' into 'master'

michael.davityan:exercise_05_29 See merge request bpcarm/trainings2017!1298
parents 53c9dc76 c4cafad3
Pipeline #24912696 failed with stage
in 1 minute 36 seconds
progname=exercise_05_29
CC=g++
CFLAGS=-Wall -Wextra -Werror -g3
all: test1
debug/$(progname): debug/$(progname).o
$(CC) $(CFLAGS) $< -o $@
debug/%.o: debug/%.s
$(CC) -c $(CFLAGS) $< -o $@
debug/%.s: debug/%.ii
$(CC) -S $(CFLAGS) $< -o $@
debug/%.ii: %.cpp | debug
$(CC) -E $(CFLAGS) $< -o $@
debug:
mkdir -p debug
clean:
rm -r debug Tests/*.out
test%: debug/$(progname)
@./debug/$(progname) < Tests/$@.in > Tests/$@.out 2>&1 || echo "$@ is executing..."
@diff Tests/$@.out Tests/$@.expected && echo PASSED || echo FAILED
.PRECIOUS: debug/%.ii debug/%.s
.SECONDARY: debug/%.ii debug/%.s
#include <iostream>
#include <iomanip>
int
main()
{
std::cout << std::fixed << std::setprecision(2);
for (int integerRate = 5; integerRate <= 10; ++integerRate) {
double rate = integerRate * 0.01;
long double amount = 24.0;
std::cout << "==================================================================================\n"
<< "---------------------Peter Minuit Deposite by the years---------------------------\n"
<< "==================================================================================\n"
<< "------------------------This table for " << std::setw(2) << integerRate << "%"
<< " per annum -----------------------------\n"
<< "__________________________________________________________________________________\n";
std::cout << "Year" << std::setw(25) << "Amount on deposit" << std::endl;
for (int year = 1626; year <= 2018; ++year) {
amount *= (1.0 + rate);
std::cout << std::setw(4) << year << std::setw(25) << amount << std::endl;
}
}
std::cout << "==================================================================================\n"
<< "--------------------------------End of contents-----------------------------------\n"
<< "==================================================================================" << std::endl;
return 0;
}
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