এই আর্টিকেলে আমরা C++-এ ratio_less ফাংশনের কাজকর্ম দেখব।
ratio_less চেক করে যে ratio1-এর মান ratio2-এর মান থেকে স্ট্রিক্টলি ছোট কিনা। এটি একটি বুলিয়ান কনস্ট্যান্ট value রিটার্ন করে যা ratio1 < ratio2 হলে true (১), অন্যথায় false (০)।
সিনট্যাক্স
template <class Ratio1, class Ratio2> struct ratio_less;
প্যারামিটার
দুটি টেমপ্লেট প্যারামিটার: ratio1 এবং ratio2।
ব্যাখ্যা
যদি ratio1 < ratio2 হয়, তবে true (১), অন্যথায় false (০) রিটার্ন করে।
উদাহরণ ইনপুট-আউটপুট
Input: 1/3 and 1/2 -> Output: 1/3 is less than 1/2. Input: 1/3 and 1/5 -> Output: 1/3 is not less than 1/5.
উদাহরণ
// C++ code to demonstrate the working of ratio_less
#include <iostream>
#include <ratio>
using namespace std;
int main() {
typedef ratio<1, 3> ratio1;
typedef ratio<1, 2> ratio2;
if (ratio_less<ratio1, ratio2>::value)
cout << "ratio1 is less than ratio2";
else
cout << "ratio1 is not less than ratio2";
return 0;
}
আউটপুট
ratio1 is less than ratio2