ACM~比较大小-类模板
来源:互联网 发布:好好说话 软件 编辑:程序博客网 时间:2024/05/16 19:31
/*烟台大学计算机学院学生 *All right reserved. *文件名称: ACM~比较大小-类模板*作者:杨飞 *完成日期:2014年5月28日 *版本号:v1.0 *对任务及求解方法的描述部分:ACM~比较大小-类模板*我的程序:*/ #include <iostream>#include <iomanip>using namespace std;template<class numtype>class Compare{public: Compare(numtype a,numtype b); numtype max(); numtype min();private: numtype x,y;};template<class numtype>Compare<numtype>::Compare(numtype a,numtype b){ x=a; y=b;}template <class numtype>numtype Compare<numtype>::max(){ return x>y?x:y;}template <class numtype>numtype Compare<numtype>::min(){ return x>y?y:x;}int main(){ int i1,i2; cin>>i1>>i2; Compare<int> cmp1(i1,i2); cout<<cmp1.max()<<" "<<cmp1.min()<<endl; float f1,f2; cin>>f1>>f2; Compare<float> cmp2(f1,f2); cout<<setiosflags(ios::fixed); cout<<setprecision(2); cout<<cmp2.max()<<" "<<cmp2.min()<<endl; char c1,c2; cin>>c1>>c2; Compare<char> cmp3(c1,c2); cout<<cmp3.max()<<" "<<cmp3.min()<<endl; return 0;}
心得体会:无!!
0 0
- ACM~比较大小-类模板
- ACM--类模板 比较大小
- acm 第一套比较大小-类模板
- 比较大小-类模板
- 比较大小-类模板
- OJ比较大小-类模板
- 2437比较大小类模板
- YTUOJ-比较大小-类模板
- OJ比较大小-类模板
- ACM-比较字母大小
- 比较大小 ——类模板
- 17周 oj 比较大小 类模板
- C++ 习题 比较大小-类模板
- C++ 习题 比较大小-类模板
- △【OJ】---Q---比较大小-类模板
- YTU-OJ- 比较大小-类模板
- OJ——比较大小-类模板
- 测试效率-模板比较大小
- webkit
- 我为什么辞掉公务员的职位去学PHP?
- android SlidingMenu简化版
- P2B高收益理财产品靠不靠谱?
- 第十三周 项目1 确定点在圆上的位置(补发)
- ACM~比较大小-类模板
- robotium 被测页面需要有intent传值得设置
- Oracle 自己容易忘的细节
- 如何使用Log4j
- Surface Pro 3想替代笔记本太难,微软正逐渐迷失方向
- 外媒:中国政府呼吁银行弃用IBM服务器
- init: cannot execve(‘XXX’):Permission denied问题
- http://www.cnblogs.com/kissdodog/archive/2013/02/24/2924236.html
- iOS5、6、7状态栏适配方法