Commit b5672201 authored by Michael's avatar Michael

michael.davityan:exercise_04_17

parent 8072b1eb
Pipeline #23050486 passed with stage
in 1 minute 54 seconds
dbg: debug/exercise_04_17
debug/exercise_04_17: debug/exercise_04_17.o
g++ -Wall -Wextra -Werror -g3 $< -o $@
debug/exercise_04_17.o: debug/exercise_04_17.s
g++ -c -Wall -Wextra -Werror -g3 $< -o $@
debug/exercise_04_17.s: debug/exercise_04_17.ii
g++ -S -Wall -Wextra -Werror -g3 $< -o $@
debug/exercise_04_17.ii: exercise_04_17.cpp
g++ -E -Wall -Wextra -Werror -g3 $< -o $@
debug/exercise_04_17.ii: | debug
debug:
mkdir -p debug
clean:
rm -rf debug *.ii *.s *.o *.out .gitignore
test: debug/exercise_04_17
./debug/exercise_04_17 < test1.in > test1.out || echo "Test 1 is executing..."
diff test1.out test1.expected && echo PASSED || echo FAILED
.PRECIOUS: exercise_04_17.ii exercise_04_17.s
.SECONDARY: exercise_04_17.ii exercise_04_17.s
#include <iostream>
#include <climits>
#include <unistd.h>
int
main()
{
if (::isatty(STDIN_FILENO)) {
std::cout << "Insert ten different integers.\n";
}
int counter = 1;
int largest = INT_MIN;
while (counter <= 10) {
int number;
std::cin >> number;
if (largest < number) {
largest = number;
}
++counter;
}
std::cout << "Largest is " << largest << std::endl;
return 0;
}
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