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

Merge branch 'exe_05_06' into 'master'

Mariet Stepanians Exercise_05_06

See merge request bpcarm/trainings2017!727
parents 54372632 08db0212
#include <iostream>
int
main()
{
int amountOfNumbers = 0;
double sum = 0.0;
while (true) {
int number;
std::cout << "Enter the number (enter 9999 to exit): ";
std::cin >> number;
if (9999 == number) {
break;
}
sum += number;
++amountOfNumbers;
}
if (amountOfNumbers != 0) {
std::cout << "Average -> " << sum / amountOfNumbers << std::endl;
}
return 0;
}
exercise_05_06: exercise_05_06.o | .gitignore
g++ $< -o $@
exercise_05_06.ii: exercise_05_06.cpp
g++ -E $< -o $@
exercise_05_06.s: exercise_05_06.ii
g++ -S $< -o $@
exercise_05_06.o: exercise_05_06.s
g++ -c $< -o $@
.gitignore:
echo "exercise_05_06" > $@
cleanup:
rm *.ii *.s *.o exercise_05_06 .gitignore
rm -rf debug
test1: exercise_05_06
@./exercise_05_06 < test1.in > test1.out
@diff test1.out test1.expected && echo PASSED || echo FAILED
.PRECIOUS: exercise_05_06.ii exercise_05_06.s
.SECONDARY: exercise_05_06.ii exercise_05_06.s
dbg: debug/exercise_05_06
debug/exercise_05_06: debug/exercise_05_06.o
g++ -Wall -Wextra -Werror -g3 debug/exercise_05_06.o -o debug/exercise_05_06
debug/exercise_05_06.o: debug/exercise_05_06.s
g++ -c -Wall -Wextra -Werror debug/exercise_05_06.s -o debug/exercise_05_06.o
debug/exercise_05_06.s: debug/exercise_05_06.ii
g++ -S -Wall -Wextra -Werror -g3 debug/exercise_05_06.ii -o debug/exercise_05_06.s
debug/exercise_05_06.ii: exercise_05_06.cpp
g++ -E -Wall -Wextra -Werror -g3 exercise_05_06.cpp -o debug/exercise_05_06.ii
debug/exercise_05_06.ii: | debug
debug:
mkdir -p debug
Enter the number (enter 9999 to exit): Enter the number (enter 9999 to exit): Enter the number (enter 9999 to exit): Enter the number (enter 9999 to exit): Average -> 15
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