宏定义:
#include <iostream>
2. using namespace std;
3.
4. #define SQ(y) ((y)*(y))
5.
6. int main(){
7. int n, sq;
8. cin>>n;
9. sq = SQ(n+1);
10. cout<<sq<<endl;
11. return 0;
12. }
内联函数:
using namespace std;
inline int SQ(int y){ return y*y; }
int main(){
int n, sq;
cin >> n;
//SQ(n)
sq = SQ(n);
cout << sq << endl;
//SQ(n+1)
sq = SQ(n + 1);
cout << sq << endl;
//200/SQ(n+1)
sq = 200 / SQ(n + 1);
cout << sq << endl;
system("pause");
return 0;
}