2 回答

一只萌萌小番薯
TA贡献1795条经验 获得超7个赞
/* 有的函数需要频繁调用 ,内置函数是嵌入主函数里的函数,在编译时将所调用的代码嵌入到主函数中,
PS:带有循环语句或者switch语句的函数不能成为内置函数 */
#include <iostream>
using namespace std;
inline int max(int a,int b,int c)
{
if(b>a)
a=b;
if (c>a)
a=c;
return a;
}
int main()
{
int i=7,j=10,k=24,m;
m=max(i,j,k);
cout <<"max = "<<m<<endl;
return 0;
}

偶然的你
TA贡献1841条经验 获得超3个赞
标准模板库(Standard Template Libarary)STL
STL的代码从广义上讲分为三类:algorithm(算法)、container(容器)和iterator(迭代器)
算法部分主要由头文件<algorithm>,<numeric>和<functional>组成。<algorithm>有你说的sort(),也是算法最多的头文件,你把algorithm头文件打开来看看就知道了~~~
容器部分主要由头文件<vector>,<list>,<deque>,<set>,<map>,<stack>和<queue>组成。
迭代器部分主要由头文件<utility>,<iterator>和<memory>组成。
非常的好用,相信你会喜欢上它。
添加回答
举报
0/150
提交
取消