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

Mary Zaqaryan Exercise_05_05 Version 1

parent b21ea84b
#include <iostream>
int
main()
{
int amount;
std::cout << "Enter the amount of numbers." << std::endl;
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::endl;
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