Website Summary Files Commits Branches @commit @diff @stats
path: root / pract_SI / Pract. 02 / Solutions / task3 - with EPSILON.cpp
blob: dcd5f88edc735ebcedece0d4216fab7d0b2bea4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	double num1, num2;

	cout << "Enter the first number: ";
	cin >> num1;

	cout << "Enter the second number: ";
	cin >> num2;

	if (fabs(num1 - num2) <= DBL_EPSILON * fabs(num1))
	{
		cout << "Numbers must be different!\n";
		return 1;
	}

	cout << (num1 > num2 ? "First"  : "Second") << " is the greater number!\n";

	return 0;
}