为了账号安全,请及时绑定邮箱和手机立即绑定

程序哪里改一下额可以实现目的

程序哪里改一下额可以实现目的

C++
breeze0 2016-05-12 16:13:17
#include <iostream>                                 // 预处理命令                                     //2using namespace std;                                // 使用标准命名空间std                      //3                                                                                                                   //4template <class ElemType>                                                                                //5ElemType Max(ElemType a, ElemType b)     // 返回最大值                                     //6{                                                                                                                 //7   return (a > b) ? a : b;                       // 返回a与b的最大值                         //8}                                                                                                                 //9                                                                                                                   //11int main(void)                                            // 主函数main(void)                          //12{                                                                                                                 //13   cout << Max(16, 518) << endl;              // 显示最大值                                     //14   cout << Max(16.8, 518) << endl;    // 显示最大值                                     //15                                                                                                                   //16   system("PAUSE");              // 调用库函数system( ), 输出系统提示信息                //17       return 0;
查看完整描述

1 回答

?
asd8532

TA贡献143条经验 获得超187个赞

cout << Max<int>(16, 518) << endl;              // 函数模板要加<>,里面要填上类型才可以的                              
cout << Max<double>(16.8, 518) << endl;


查看完整回答
1 反对 回复 2016-05-12
  • 1 回答
  • 0 关注
  • 1228 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信