ratio_greater_equal() function in C++ Last Updated : 26 Jul, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 < class ratio1_name, class ratio2_name > ratio_greater_equal Template Parameters The function accepts two template parameters ratio1 and ratio2 which are to be compared. Return value: The function returns a boolean value which is true if the ratio1 is greater than or equal to the ratio2 otherwise it returns false. Below programs illustrates the above function: Program 1: CPP // C++ program to illustrate the // ratio_greater_equal function // when both the ratios are equal #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<3, 9> ratio1; typedef ratio<1, 3> ratio2; // check if R1>=R2 if (ratio_greater_equal<ratio1, ratio2>::value) cout << "3/9 is greater than or equal to 1/3"; else cout << "3/9 is less than 1/3"; return 0; } Output: 3/9 is greater than or equal to 1/3 Program 2: CPP // C++ program to illustrate the // ratio_greater_equal function // to show greater than #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<1, 2> ratio1; typedef ratio<1, 3> ratio2; // check if R1>=R2 if (ratio_greater_equal<ratio1, ratio2>::value) cout << "1/2 is greater than or equal to 1/3"; else cout << "1/2 is less than 1/3"; return 0; } Output: 1/2 is greater than or equal to 1/3 Program 3: CPP // C++ program to illustrate the // ratio_greater_equal function // to show when less than #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<1, 10> ratio1; typedef ratio<1, 8> ratio2; // check if R1>=R2 if (ratio_greater_equal<ratio1, ratio2>::value) cout << "1/10 is greater than or equal to 1/8"; else cout << "1/10 is less than 1/8"; return 0; } Output: 1/10 is less than 1/8 Comment More infoAdvertise with us Next Article ratio_less_equal() function in C++ T Twinkl Bajaj Follow Improve Article Tags : C++ STL CPP-Library CPP-Functions cpp-ratio +1 More Practice Tags : CPPSTL Similar Reads 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 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_less() function in C++ The ratio_less() is an inbuilt function in C++ which checks if the ratio R1 is less than the ratio R2. It returns True if the ratio is less than ratio 2, else it returns false. Syntax: template ratio_less Template Parameters: The function accepts two template parameters ratio1 and ratio2 which are t 2 min read ratio_equal() in C++ with examples 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 1 min read 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 equal_range in C++ std::equal_range is used to find the sub-range within a given range [first, last) that has all the elements equivalent to a given value. It returns the initial and the final bound of such a sub-range. This function requires the range to be either sorted or partitioned according to some condition suc 5 min read Like