正在加载图片...
函数举例 ex04_fun_01.cpp #include <iostream> using namespace std; ex04_fun_02.cpp int my_max(int x,int y) 1函数定义,在主调函数前 { if (x y)return x; else return y; int main() { int m,n,p; cout <"please input m and n:" cin >m >n; p=my_max(m,n);/函数调用 cout <<"max("<<m <<","<<n <<")="<<p<<endl; return 0; 7 http://math.ecnu.edu.cn/~jypan http://math.ecnu.edu.cn/~jypan 函数举例 7 #include <iostream> using namespace std; int my_max(int x, int y) // 函数定义,在主调函数前 { if (x > y) return x; else return y; } int main() { int m, n, p; cout << "please input m and n: " ; cin >> m >> n; p = my_max(m,n); // 函数调用 cout << "max(" << m <<"," << n <<")=" << p << endl; return 0; } ex04_fun_01.cpp ex04_fun_02.cpp
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有