Voorwaarde - Verhoudingsmanipulaties in C++ | Set 1 (rekenkunde)
In C++ de
- verhouding_gelijk
- verhouding_niet_gelijk
- verhouding_groter
- ratio_loos
- ratio_groter_gelijk
- ratio_less_equal
1. ratio_equal: Deze sjabloonalias controleert of de verhoudingen in zijn argumenten zijn gelijk . Retourneert waar als gelijk anders onwaar retourneert. Het retourneert een Booleaans lid constante 'waarde' .
2. ratio_not_equal: Deze sjabloonalias controleert of de verhoudingen in zijn argumenten zijn niet gelijk . Retourneert waar als het niet gelijk is, anders als gelijk onwaar retourneert. Het retourneert een Booleaans lid constante 'waarde' .
wat is een dubbele JavaCPP
// 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; }
Uitvoer
Ratios are equal Ratios are equal
3. ratio_groter: Deze tijdelijke alias controleert of ratio1 is groter dan ratio2 . Het retourneert een Booleaans lid constante 'waarde' die true retourneert als ratio1 groter is dan ratio2 en anders false retourneert.
4. ratio_less: Deze tijdelijke alias controleert of ratio1 is kleiner dan ratio2 . Het retourneert een Booleaans lid constante 'waarde' die true retourneert als ratio1 kleiner is dan ratio2 en anders false retourneert.
// 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; }
Uitvoer
ratio1 is not greater than ratio2 ratio1 is less than ratio2
5. ratio_greater_equal: Deze tijdelijke alias controleert of ratio1 is groter dan of gelijk aan ratio2 . Het retourneert een Booleaans lid constante 'waarde' die true retourneert als ratio1 groter of gelijk is dan ratio2 en anders false retourneert.
6. ratio_less_equal: Deze tijdelijke alias controleert of ratio1 is kleiner dan of gelijk aan ratio2 . Het retourneert een Booleaans lid constante 'waarde' die true retourneert als ratio1 kleiner of gelijk is dan ratio2 en anders false retourneert.
hoop sorterenCPP
// 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; }
Uitvoer
ratio1 is greater or equal than ratio2 ratio1 is less or equal than ratio2