// 使用内联而不是宏 #include <iostream> using namespace std; inline unsigned long Square(unsigned long a) { return a * a; } inline unsigned long Cube(unsigned long a) { return a * a * a; } int main() { unsigned long x = 1; for (;;) { cout << "Enter a number (0 to quit): "; cin >> x; if (x == 0) break; cout << "You entered: " << x; cout << ". Square(" << x << "): "; cout << Square(x); cout << ". Cube(" << x << "): "; cout << Cube(x) << "." << endl; } return 0; }
by: 发表于:2018-02-01 09:52:27 顶(0) | 踩(0) 回复
??
回复评论