Commit 36877117 authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'exe_22' into 'master'

Exercise_05_22, Version1

See merge request bpcarm/trainings2017!1205
parents d3981703 4a4579f1
exercise_05_22: 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_22" > $@
clean:
rm *.ii *.s *.o *.out exercise_05_22 .gitignore
test: exercise_05_22
@./exercise_05_22 < 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()
{
{///a
int x;
std::cout << "Enter the first number: ";
std::cin >> x;
int y;
std::cout << "Enter the second number: ";
std::cin >> y;
if ((x >= 5 && y < 7) == (!(x < 5) && !(y >= 7))) {
std::cout << "The first expression is true." << std::endl;
}
}
{///b
int x;
std::cout << "Enter the first number: ";
std::cin >> x;
int y;
std::cout << "Enter the second number: ";
std::cin >> y;
int z;
std::cout << "Enter the third number: ";
std::cin >> z;
if ((x != y || 5 == z) == (!(x == y) || !(z != 5))) {
std::cout << "The second expression is true." << std::endl;
}
}
{///c
int x;
std::cout << "Enter the first number: ";
std::cin >> x;
int y;
std::cout << "Enter the second number: ";
std::cin >> y;
if ((x > 8 || y <= 4) == (!((x <=8) && (y > 4)))) {
std::cout << "The third expression is true." << std::endl;
}
}
{///d
int x;
std::cout << "Enter the first number: ";
std::cin >> x;
int y;
std::cout << "Enter the second number: ";
std::cin >> y;
if ((x <= 4 && y > 6) == (!((x > 4) || (y <= 6)))) {
std::cout << "The forth expression is true." << std::endl;
}
}
}
Enter the first number: Enter the second number: The first expression is true.
Enter the first number: Enter the second number: Enter the third number: The second expression is true.
Enter the first number: Enter the second number: The third expression is true.
Enter the first number: Enter the second number: The forth expression is true.
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