#Comparing 2 numbers

12 messages · Page 1 of 1 (latest)

normal kernel
#
#include <iostream>
#include <cmath>
#include "window.h"
typedef BOOL int;
int main() {
    float num1, num2;
    
    std::cout << "Enter the first number: ";
    std::cin >> num1;
    
    std::cout << "Enter the second number: ";
    std::cin >> num2;
    
    if (std::abs(num1 - num2) < 0.00001) {
        std::cout << "Both numbers are very much equal." << std::endl;
    } else if (num1 < num2) {
        std::cout << "The first number is smaller than the second number." << std::endl;
    } else {
        std::cout << "The first number is greater than the second number." << std::endl;
    }
    
    return 0;
}
swift imp
#

use std::numeric_limits<float>::epsilon() from <limits> instead of 0.00001

#

also just print a \n character instead of std::endl

#

and what do #include "window.h" and typedef BOOL int do?

normal kernel
swift imp
#

mm no?

#

not necessarily

#

i believe so

normal kernel
#

mm ok

swift imp
#

why did you think that

#

er, where did you learn that bit

normal kernel
#

eh i mean to print stuff on console or whatever how else is gonna do that without using some system functions or what☠️