Commit 985abe57 by Artak Yenokyan

Merge branch 'exe_05_08' into 'master'

Exercise_05_08, Version1 See merge request bpcarm/trainings2017!1189
parents 89f1a6c7 ab9c3bcf
exercise_05_08: main.o | .gitignore
g++ $^ -o $@
main.ii: main.cpp
g++ -E $^ -o $@
main.s: main.ii
g++ -S $^ -o $@
main.o: main.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_08" > $@
clean:
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
.PRECIOUS: main.ii main.s
.SECONDARY: main.ii main.s
#include <iostream>
int
main()
{
int count;
std::cout << "Enter the count of numbers: ";
std::cin >> count;
if(count <= 0) {
std::cerr << "Error 1: Non positive count." << std::endl;
return 1;
}
int smallest = 2147483647;
for (int i = 1; i < count; ++i) {
int number;
std::cin >> number;
if (number < smallest) {
smallest = number;
}
}
std::cout << "Smallest number is " << smallest << std::endl;
return 0;
}
Enter the count of numbers: Smallest number is -23
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