ratio_equal() in C++ with examples Last Updated : 20 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The ratio_equal() is an inbuilt function in C++ STL that checks if two given ratios are equal or not. Syntax: template < class ratio1_name, class ratio2_name > ratio_equal Template Parameters: The function accepts two template parameters ratio1 and ratio2 which are to be compared. Return value: The function returns true if the ratios are equal otherwise it returns false. Time Complexity: O(1) Auxiliary Space: O(1) Below programs illustrate the ratio_equal() function: Program 1: CPP // C++ program to illustrate the // ratio_equal function #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<3, 9> ratio1; typedef ratio<1, 3> ratio2; // If both the ratios are same if (ratio_equal<ratio1, ratio2>::value) cout << "Both ratio are equal"; else cout << "Both ratio are not equal"; return 0; } Output:Both ratio are equal Program 2: CPP // C++ program to illustrate the // ratio_equal function #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<1, 2> ratio1; typedef ratio<5, 4> ratio2; // If both the ratios are same if (ratio_equal<ratio1, ratio2>::value) cout << "Both ratio are equal"; else cout << "Both ratio are not equal"; return 0; } Output:Both ratio are not equal Comment More infoAdvertise with us Next Article ratio_less_equal() function in C++ T Twinkl Bajaj Follow Improve Article Tags : Misc C++ STL CPP-Library CPP-Functions cpp-template cpp-ratio +3 More Practice Tags : CPPMiscSTL Similar Reads ratio_not_equal() in C++ with examples The ratio_not_equal is an inbuilt function in C++ STL that checks if two given ratios are not equal or equal. Syntax: template < class ratio1_name, class ratio2_name > ratio_not_equal Template Parameters: The function accepts two template parameters ratio1 and ratio2 which are to be compared. 1 min read pthread_equal() in C with example Prerequisite : Multithreading, pthread_self() in C with Example pthread_equal() = This compares two thread which is equal or not. This function compares two thread identifiers. It return '0' and non zero value. If it is equal then return non zero value else return 0. Syntax:- int pthread_equal (pthr 2 min read FloatBuffer equals() method in Java with Examples The equals() method of java.nio.FloatBuffer Class is used to check whether or not the given buffer is equal to another object. Two float buffers are equal if, and only if, They have the same element type, They have the same number of remaining elements, and The two sequences of remaining elements, c 4 min read ratio_greater_equal() function in C++ The ratio_greater_equal() is an inbuilt function in C++ which checks if the ratio R1 is greater than or equal to the ratio R2. It returns True if the ratio is greater than or equal to ratio 2, else it returns false. Syntax: template ratio_greater_equal Template Parameters The function accepts two te 2 min read ratio_less_equal() function in C++ The ratio_less_equal() is an inbuilt function in C++ which checks if the ratio R1 is less than or equal to the ratio R2. It returns True if the ratio is less than or equal to ratio 2, else it returns false. Syntax: template < class ratio1_name, class ratio2_name > ratio_less_equal Template Par 2 min read ratio_greater() function in C++ The ratio_greater() is an inbuilt function in C++ which checks if the ratio R1 is greater than the ratio R2. It returns True if the ratio is greater than ratio 2, else it returns false. Syntax: template ratio_greater Template Parameters The function accepts two template parameters ratio1 and ratio2 2 min read Like