标题:帮忙解决问题
取消只看楼主
晓宁
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2011-9-7
结帖率:71.43%
 问题点数:0 回复次数:0 
帮忙解决问题
#include<iostream>
using namespace std;

class Customer
{
protected:
    char Customer_name[20];
    int IC_number;
public:
    void get()
    {
        cout<<"\nEnter Customer Name: ";
         cin>>Customer_name;
         cout<<"\nEnter Customer IC: ";
         cin>>IC_number;
    }
};

class Prize : private Customer
{
private:
    double pa;
public:
    void accept();
    void display();
};

void Prize :: accept()
{
    get();
    cout<<"\nEnter the purchase amount:";
    cin>>pa;
}

void Prize :: display()
{
    if(pa > 5000)
        cout<<"\nThe Customer will get a plate set as a free gift."<<endl;
else
    if(pa = 5000) || (pa < 5000) && (pa > 3000)
        cout<<"\nThe free gift is a limited edition container."<<endl;
else
    if(pa = 3000) || (pa < 3000)
        cout<<"\nNo free gift."<<endl;

}

void main()
{
    Prize obj;
    obj.accept();
    obj.display();
}
搜索更多相关主题的帖子: 解决问题 
2011-09-26 21:58



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




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

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