ANSI 标准是为了确保 C++ 的便携性

时间:2023-03-09 17:00:24
ANSI 标准是为了确保 C++ 的便携性

ANSI 标准
ANSI 标准是为了确保 C++ 的便携性 —— 您所编写的代码在 Mac、UNIX、Windows、Alpha 计算机上都能通过编译。

由于 ANSI 标准已稳定使用了很长的时间,所有主要的 C++ 编译器的制造商都支持 ANSI 标准。

 #include <iostream>

 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int max(int x,int y);//声明
int a,b,c;
cin >>a >>b;
c=max(a,b);//调用
cout <<"max="<<c<<endl;
return ;
} int max(int x,int y)//定义
{
int z;
if(x>y)z=x;
else z=y;
return(z);
}