C++ 入門指南 4.01
練習 21.10 參考程式 - 練習標準程式庫的數學相關程式
// 引入標準程式庫中相關的輸入、輸出程式
#include <iostream>
// 引入標準程式庫中數學相關程式
#include <cmath>
// cout 為 std 中的輸出物件
using std::cout;
// endl 為 std 中的斷行符號
using std::endl;
int main(void) {
// 比較是否大於
cout << isgreater(2, 3) << endl;
// 比較是否大於或相等
cout << isgreaterequal(3, 3) << endl;
// 比較是否小於
cout << isless(2, 3) << endl;
// 比較是否小於或相等
cout << islessequal(3, 3) << endl;
// 比較是否大於或小於
cout << islessgreater(3, 3) << endl;
// 最後回傳 0 給作業系統
return 0;
}
/* 《程式語言教學誌》的範例程式
http://kaiching.org/
檔名:exercise2110.cxx
編譯:g++ exercise2110.cxx
執行:./a.out
功能:C++入門指南單元二十一的練習
作者:張凱慶 */
回到練習題目