#include
#include<stdlib.h>
using namespace std;
int main(void)
{
int x, y, z;
int max(int, int);
cout << “输入两个整数;”;
cin >> x >> y;
z = max(x, y);
cout << “max=” << z;
system(“pause”);
return 0;
}
int max(int x, int y)
{
return(x > y ? x : y);
}
这里C++与之前的C语言相似
源文件在VS 2017须采用iostream 不加.h
其次use namespace std;在这里是为了简化对cin/cout 的引用。但对它具体的作用还不太明了。
07-22
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交