| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 479 人关注过本帖
标题:如此简单的程序,竟不知如何改提示的那个错了..
只看楼主 加入收藏
云の翼
Rank: 1
等 级:新手上路
帖 子:17
专家分:3
注 册:2012-6-25
结帖率:87.5%
收藏
已结贴  问题点数:38 回复次数:3 
如此简单的程序,竟不知如何改提示的那个错了..
#include"iostream.h"
#include"string.h"
class Person
{
private:
    char *name,sex[10],id[10];
    float hour,salary,unitwage;
public:
    void information();
    void show();
};
void main()
{
    Person li;
    li.information();
    cout<<"now output the person's salary:";
    li.show();

}
void Person::information()
{
    cout<<"input personal information!:"<<endl;
    cout<<"please input name:"<<endl;
    cin>>name>>endl;
    cout<<"please input hour:"<<endl;
    cin>>hour>>endl;
    cout<<"please input id:"<<endl;
    cin>>id>>endl;
    cout<<"please input sex:"<<endl;
    cin>>sex>>endl;
    cout<<"please input unitwage:"<<endl;
    cin>>unitwage>>endl;
}
void Person::show()
{
    cout<<"name"<<name<<"id"<<id<<endl;
    if(0<hour<=40)
        cout<<"salary="<<hour*unitwage<<endl;
    if(40<hour<=60)
        cout<<"salary="<<40*unitwage+(hour-40)*1.5*unitwage<<endl;
    if(hour>60)
        cout<<"salary="<<40*unitwage+20*1.5*unitwage+(hour-60)*3*unitwage<<endl;
}
C:\Documents and Settings\Administrator\桌面\勤の卿\My Program\C++程序设计与应用\salary\salary.cpp(30) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class ostream &(__cdecl *)(class ostream &)'
(or there is no acceptable conversion)



   
搜索更多相关主题的帖子: include private personal void 
2012-09-09 11:21
寒风中的细雨
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:66
帖 子:1710
专家分:8645
注 册:2009-9-15
收藏
得分:10 
cin>>endl;//全部删掉
2012-09-09 13:39
xinghaojie7
Rank: 2
等 级:论坛游民
帖 子:2
专家分:28
注 册:2012-9-14
收藏
得分:18 
#include"iostream.h"
#include"string.h"
class Person
{
private:
    char name[20],sex[10],id[10];
    float hour,salary,unitwage;
public:
    void information();
    void show();
};
void main()
{
    Person li;
    li.information();
    cout<<"now output the person's salary:";
    li.show();

}
void Person::information()
{
    cout<<"input personal information!:"<<endl;
    cout<<"please input name:"<<endl;
    cin>>name;
    cout<<"please input hour:"<<endl;
    cin>>hour;
    cout<<"please input id:"<<endl;
    cin>>id;
    cout<<"please input sex:"<<endl;
    cin>>sex;
    cout<<"please input unitwage:"<<endl;
    cin>>unitwage;
}
void Person::show()
{
    cout<<"name"<<name<<"id"<<id<<endl;
    if(hour>0&&hour<=40)
        cout<<"salary="<<hour*unitwage<<endl;
    if(hour>40&&hour<=60)
        cout<<"salary="<<40*unitwage+(hour-40)*1.5*unitwage<<endl;
    if(hour>60)
        cout<<"salary="<<40*unitwage+20*1.5*unitwage+(hour-60)*3*unitwage<<endl;
}
2012-09-14 09:48
xinghaojie7
Rank: 2
等 级:论坛游民
帖 子:2
专家分:28
注 册:2012-9-14
收藏
得分:10 
#include"iostream.h"
#include"string.h"
class Person
{
private:
    char name[20],sex[10],id[10];
    float hour,salary,unitwage;
public:
    void information();
    void show();
};
void main()
{
    Person li;
    li.information();
    cout<<"now output the person's salary:";
    li.show();

}
void Person::information()
{
    cout<<"input personal information!:"<<endl;
    cout<<"please input name:"<<endl;
    cin>>name;
    cout<<"please input hour:"<<endl;
    cin>>hour;
    cout<<"please input id:"<<endl;
    cin>>id;
    cout<<"please input sex:"<<endl;
    cin>>sex;
    cout<<"please input unitwage:"<<endl;
    cin>>unitwage;
}
void Person::show()
{
    cout<<"name"<<name<<"id"<<id<<endl;
    if(hour>0&&hour<=40)
        cout<<"salary="<<hour*unitwage<<endl;
    if(hour>40&&hour<=60)
        cout<<"salary="<<40*unitwage+(hour-40)*1.5*unitwage<<endl;
    if(hour>60)
        cout<<"salary="<<40*unitwage+20*1.5*unitwage+(hour-60)*3*unitwage<<endl;
}
2012-09-14 10:20
快速回复:如此简单的程序,竟不知如何改提示的那个错了..
数据加载中...
 
   



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

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