Commit 54ad6862 authored by Believer Programmers' Club's avatar Believer Programmers' Club

Merge branch 'exercise_05_08' into 'master'

Mary Zaqaryan Exercise_05_08 Version1 See merge request bpcarm/trainings2017!1304
parents 82422530 edae251f
Pipeline #25174745 failed with stage
in 2 minutes 16 seconds
#include <iostream>
#include <climits>
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 min = INT_MAX;
for (int i = 1; i <= amount; ++i) {
int number;
std::cout << "Enter number.";
std::cin >> number;
if (number < min) {
min = number;
}
}
std::cout << "Minimum is " << min << std::endl;
return 0;
}
exercise_05_08: exercise_05_08.o | .gitignore
g++ $^ -o $@
exercise_05_08.ii: exercise_05_08.cpp
g++ -E $^ -o $@
exercise_05_08.s: exercise_05_08.ii
g++ -S $^ -o $@
exercise_05_08.o: exercise_05_08.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_08" > $@
removes:
rm *.ii *.s *.o *.out exercise_05_08 .gitignore
test: exercise_05_08
./exercise_05_08 < 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.Enter number.Enter number.Enter number.Minimum is -218562
8
56552
-218562
0
4263
-658
755512
8
-5297
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