Commit 111c0aed authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'ex2.25' into 'master'

exercise_02_25

See merge request bpcarm/trainings2017!1415
parents 498c59e5 1ea6d198
progname=exercise_02_25
CC=g++
CFLAGS=-Wall -Wextra -Werror -g3
$(progname): $(progname).o | .gitignore
$(CC) $(CFLAGS) $^ -o $@
%.ii: %.cpp
$(CC) -E $(CFLAGS) $^ -o $@
%.s: %.ii
$(CC) -S $(CFLAGS) $^ -o $@
%.o: %.s
$(CC) -c $(CFLAGS) $^ -o $@
.gitignore:
echo $(progname) > $@
clean:
rm -f *.ii *.s *.o *.out $(progname) .gitignore
test: $(progname)
echo process is executing...
./$(progname) < $@.in > $@.out || echo "negative case"
diff $@.out $@.expected && echo PASSED || echo FAILED
.PRECIOUS: $(progname).ii $(progname).s
.SECONDARY: $(progname).ii $(progname).s
#include<iostream>
int
main()
{
int number1, number2;
std::cin >> number1 >> number2;
if (0 == number2) {
std::cout << "Error 1: Second number can not be 0" << std::endl;
return 1;
}
if (number1 % number2 == 0) {
std::cout << "First number is a multiple of the second" << std::endl;
return 0;
}
std::cout << "First number is not a multiple of the second" << std::endl;
return 0;
}
First number is not a multiple of the second
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