תְנַאִי מוּקדָם - מניפולציות יחס ב- C ++ | סט 1 (חשבון)
ב- C ++
- Ratio_equal
- ratio_not_equal
- ratio_greater
- Ratio_less
- ratio_greater_equal
- ratio_less_equal
1. Ratio_equal: כינוי תבנית זו בודק אם יחסי בטיעוניו שווים ו חוזר נכון אם שווה אחר חוזר שקר. זה חוזר א חבר בוליאני קָבוּעַ 'עֵרֶך' ו
2. Ratio_Not_equal: כינוי תבנית זו בודק אם יחסי בטיעוניה הם לא שווה ו חוזר נכון אם לא שווה אחרת אם שווה חוזר שקר. זה חוזר א חבר בוליאני קָבוּעַ 'עֵרֶך' ו
שחקן ממטה קולקרניCPP
// C++ code to demonstrate the working of // ratio_equal and ratio_not_equal #include #include // for ratio manipulation using namespace std; // Driver Code int main() { // Declaring ratios typedef ratio<10 100> ratio1; typedef ratio<1 10> ratio2; // Checking if ratios are equal using ratio_equal ratio_equal<ratio1 ratio2>::value ? cout << 'Ratios are equal' : cout << 'Ratios are not equal'; cout << endl; // Checking if ratios are not equal using // ratio_not_equal ratio_not_equal<ratio1 ratio2>::value ? cout << 'Ratios are not equal' : cout << 'Ratios are equal'; return 0; }
תְפוּקָה
Ratios are equal Ratios are equal
3. Ratio_greater: הכינוי הזמני הזה בודק אם RATIO1 גדול יותר מ- RATIO2 ו זֶה מחזיר חבר בוליאני קָבוּעַ 'עֵרֶך' מה שמחזיר נכון אם Retio1 גדול יותר מ- Retio2 אחרת מחזיר שקר.
4. Ratio_less: הכינוי הזמני הזה בודק אם Ratio1 הוא פחות מטיפול 2 ו זֶה מחזיר חבר בוליאני קָבוּעַ 'עֵרֶך' מה שמחזיר נכון אם Retio1 פחות מאשר Ratio2 אחרת מחזירה כוזבת.
// C++ code to demonstrate the working of // ratio_greater and ratio_less #include #include // for ratio manipulation using namespace std; // Driver Code int main() { // Declaring ratios typedef ratio<10 100> ratio1; typedef ratio<11 100> ratio2; // Checking if ratio1 is greater than ratio2 // using ratio_greater ratio_greater<ratio1 ratio2>::value ? cout << 'ratio1 is greater than ratio2' : cout << 'ratio1 is not greater than ratio2'; cout << endl; // Checking if ratio1 is less than ratio2 // using ratio_less ratio_less<ratio1 ratio2>::value ? cout << 'ratio1 is less than ratio2' : cout << 'ratio1 is not less than ratio2'; cout << endl; return 0; }
תְפוּקָה
ratio1 is not greater than ratio2 ratio1 is less than ratio2
5. ratio_greater_equal: הכינוי הזמני הזה בודק אם Ratio1 גדול או שווה מאשר יחס 2 ו זֶה מחזיר חבר בוליאני קָבוּעַ 'עֵרֶך' מה שמחזיר נכון אם Retio1 גדול יותר או שווה מאשר Ratio2 אחר מחזיר שקר.
6. ratio_less_equal: הכינוי הזמני הזה בודק אם Ratio1 פחות או שווה מאשר יחס 2 ו זֶה מחזיר חבר בוליאני קָבוּעַ 'עֵרֶך' מה שמחזיר נכון אם Retio1 פחות או שווה מאשר Retio2 אחרת מחזירה כוזבת.
יוניקס לעומת חלונותCPP
// C++ code to demonstrate the working of // ratio_greater_equal and ratio_less_equal #include #include // for ratio manipulation using namespace std; // Driver Code int main() { // Declaring ratios typedef ratio<10 100> ratio1; typedef ratio<1 10> ratio2; // Checking if ratio1 is greater or equal than ratio2 // using ratio_greater_equal ratio_greater_equal<ratio1 ratio2>::value ? cout << 'ratio1 is greater or equal than ratio2' : cout << 'ratio1 is not greater or equal than ' 'ratio2'; cout << endl; // Checking if ratio1 is less or equal than ratio2 // using ratio_less_equal ratio_less_equal<ratio1 ratio2>::value ? cout << 'ratio1 is less or equal than ratio2' : cout << 'ratio1 is not less or equal than ratio2'; cout << endl; return 0; }
תְפוּקָה
ratio1 is greater or equal than ratio2 ratio1 is less or equal than ratio2