| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1683 人关注过本帖
标题:一个c++错误请大家指点
取消只看楼主 加入收藏
wghost
Rank: 2
等 级:论坛游民
帖 子:47
专家分:31
注 册:2009-6-6
结帖率:37.5%
收藏
已结贴  问题点数:20 回复次数:0 
一个c++错误请大家指点
#include<iostream>
using namespace std;
#include"student.h"
int main()
{   void max(student *p1);
    student stud[3]={student(1,56.8),student(2,89.3),student(3,78.3)},*p=stud;
    max(stud);
    return 0;
}
void max(student *p1)
{int i,j;
double t;
 
 for(i=0;i<2;i++)
    for(j=i+1;j<3;j++)
    if(*(p1+i)<*(p1+j))
     {t=p1[i];p1[i]=p1[j];p1[j]=t;}
}
其中红色部分提示一下错误:
D:\c++\ex3_h51\f.cpp(16) : error C2784: 'bool __cdecl std::operator <(const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce template argument for 'const class std::revers
e_iterator<_RI,_Ty,_Rt,_Pt,_D> &' from 'class student'
D:\c++\ex3_h51\f.cpp(16) : error C2784: 'bool __cdecl std::operator <(const struct std::pair<_T1,_T2> &,const struct std::pair<_T1,_T2> &)' : could not deduce template argument for 'const struct std::pair<_T1,_T2> &' from 'class student'
D:\c++\ex3_h51\f.cpp(16) : error C2676: binary '<' : 'class student' does not define this operator or a conversion to a type acceptable to the predefined operator
D:\c++\ex3_h51\f.cpp(17) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class student' (or there is no acceptable conversion)
D:\c++\ex3_h51\f.cpp(17) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'double' (or there is no acceptable conversion)
Error executing cl.exe.
我是初学者,请指教!
搜索更多相关主题的帖子: return 
2009-10-27 12:53
快速回复:一个c++错误请大家指点
数据加载中...
 
   



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

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