Commit 0be65a55 authored by Believer Programmers' Club's avatar Believer Programmers' Club

Merge branch 'exercise_05_05' into 'master'

Mary Zaqaryan Exercise_05_05 Version 1

See merge request bpcarm/trainings2017!1300
parents c8c85893 120ff93a
#include <iostream>
int
main()
{
int amount;
std::cout << "Enter the amount of numbers: ";
std::cin >> amount;
if (amount < 0) {
std::cerr << "Error 1: amount can't be negative or equal 0.";
return 1;
}
int sum = 0;
for (int i = 1; i <= amount; ++i) {
int number;
std::cout << "Enter number: ";
std::cin >> number;
sum += number;
}
std::cout << "Sequence of integers is " << sum << std::endl;
return 0;
}
exercise_05_05: exercise_05_05.o | .gitignore
g++ $^ -o $@
exercise_05_05.ii: exercise_05_05.cpp
g++ -E $^ -o $@
exercise_05_05.s: exercise_05_05.ii
g++ -S $^ -o $@
exercise_05_05.o: exercise_05_05.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_05" > $@
removes:
rm *.ii *.s *.o *.out exercise_05_05 .gitignore
test: exercise_05_05
./exercise_05_05 < test.in > test.out
diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
Enter the amount of numbers: Enter number: Enter number: Enter number: Enter number: Enter number: Sequence of integers is 1500
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