CPlusPlusThings/practical_exercises/10_day_practice/day3/内联函数.cpp
2023-01-02 20:39:00 +08:00

18 lines
344 B
C++

#include<iostream>
using namespace std;
//函数声明
inline double CalArea(double radius);
int main(int argc, char const *argv[])
{
double r(3.0);
double area;
area = CalArea(r);
cout<<area<<endl;
system("pause");
return 0;
}
//加关键字inline
inline double CalArea(double radius)
{
return 3.14*radius*radius;
}