ex213.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:0k
源码类别:
书籍源码
开发平台:
Visual C++
- #include <iostream.h>
- int max(int x,int y); //函数声明,max()函数版本1
- float max(float x,float y);//函数声明,max()函数版本2
- void main()
- {
- int x1,y1,z1;
- float x2,y2,z2;
- cout<<"Please input two int and two float:"<<endl;
- cin>>x1>>y1; //读入两个数值赋给x1和y1
- cin>>x2>>y2; //读入两个数值赋给x2和y2
- z1=max(x1,y1);
- z2=max(x2,y2);
- cout<<"z1="<<z1<<endl;
- cout<<"z2="<<z2<<endl;
- }
- int max(int x,int y)
- {
- return x>y?x:y;
- }
- float max(float x,float y)
- {
- return x>y?x:y;
- }
English
