Commit e195a1a3 authored by mary.zaqaryan's avatar mary.zaqaryan

Mary Zaqaryan Exercise_05_06 Version 1

parent b21ea84b
#include <iostream>
int
main()
{
double sum = 0;
int counter = 0;
while (true) {
int number;
std::cout << "Enter the number or 9999 to quit." << std::endl;
std::cin >> number;
if (number == 9999) {
break;
}
sum += number;
++counter;
}
double average = sum / counter;
std::cout << "Average is: " << average << 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" > $@
removes:
rm *.ii *.s *.o *.out exercise_05_06 .gitignore
test: exercise_05_06
./exercise_05_06 < test.in > test.out
diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
Enter the number or 9999 to quit.
Enter the number or 9999 to quit.
Enter the number or 9999 to quit.
Enter the number or 9999 to quit.
Enter the number or 9999 to quit.
Enter the number or 9999 to quit.
Average is: 9
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