标题:使用函数模板出现了一点问题
取消只看楼主
Mycr
Rank: 1
等 级:新手上路
帖 子:203
专家分:0
注 册:2006-9-18
 问题点数:0 回复次数:1 
使用函数模板出现了一点问题

#include "iostream"
using std::cout;
using std::cin;
using std::endl;

template <class T>
T maximum( T value1, T value 2, T value3)
{
T max=value1;
if(value2>max)
max=value2;
if(value3>max)
max=value3;
return max;
}
int main()
{
int int1,int2,int3;
cout<<"input three integer values:\n";
cin>>int1>>int2>>int3;
cout<<"maximum(int1,int2,int3)";
cout<<endl;
return 0;
}

运行出现了下列错误:
E:\C++\3_27\3_27.cpp(7) : error C2143: syntax error : missing ',' before 'constant'

搜索更多相关主题的帖子: max 函数 模板 std cout 
2006-10-27 08:45
Mycr
Rank: 1
等 级:新手上路
帖 子:203
专家分:0
注 册:2006-9-18
得分:0 

原来是打成分开去了


2006-10-27 21:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-99052-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.421677 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved