zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

C++标准 确保 为了 ansi
2023-09-14 09:12:06 时间

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

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

 

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     int max(int x,int y);//声明 
 7     int a,b,c;
 8     cin >>a >>b;
 9     c=max(a,b);//调用 
10     cout <<"max="<<c<<endl;
11     return 0;
12 }
13 
14 int max(int x,int y)//定义 
15 {
16     int z;
17     if(x>y)z=x;
18     else z=y;
19     return(z);
20 }