কম্পিউটার টিউটোরিয়াল

C++-এ ratio_greater_equal ফাংশন

এই আর্টিকেলে আমরা C++-এ ratio_greater_equal ফাংশনের কাজকর্ম দেখব।

ratio_greater_equal চেক করে যে ratio1-এর মান ratio2-এর মান থেকে বড় অথবা সমান কিনা। এটি একটি বুলিয়ান কনস্ট্যান্ট value রিটার্ন করে যা ratio1 >= ratio2 হলে true (১), অন্যথায় false (০)।

সিনট্যাক্স

template <class Ratio1, class Ratio2> struct ratio_greater_equal;

প্যারামিটার

দুটি টেমপ্লেট প্যারামিটার: ratio1 এবং ratio2।

ব্যাখ্যা

যদি ratio1 >= ratio2 হয়, তবে true (১), অন্যথায় false (০) রিটার্ন করে।

typedef ব্যাখ্যা

typedef ব্যবহার করে ডেটা টাইপের একটি নতুন নাম (এলিয়াস) দেওয়া হয়। এখানে রেশিও ডিক্লেয়ার করার জন্য typedef ব্যবহার করা হয়েছে।

উদাহরণ ইনপুট-আউটপুট

Input: 1/3 and 3/9  -> Output: 3/9 is greater than or equal to 1/3.
Input: 4/16 and 4/16 -> Output: 4/16 is equal to 4/16.

উদাহরণ

// C++ code to demonstrate the working of ratio_greater_equal
#include <iostream>
#include <ratio>
using namespace std;

int main() {
    // Declaring ratios
    typedef ratio<10, 100> ratio1; // 1/10
    typedef ratio<1, 10> ratio2;    // 1/10
    // Checking ratio1 is greater than or equal to ratio2.
    if (ratio_greater_equal<ratio1, ratio2>::value)
        cout << "ratio1 is greater than or equal to ratio2";
    else
        cout << "ratio1 is not greater than or equal to ratio2";
    cout << endl;
    return 0;
}

আউটপুট

ratio1 is greater than or equal to ratio2
  1. C++-এ fma() ফাংশন

  2. C++ STL-এ iswctype() ফাংশন

  3. C++-এ log() ফাংশন

  4. C++-এ swap() ফাংশন