⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookorder.cpp

📁 C++程序设计源代码例
💻 CPP
字号:
#include <iostream.h>
#include <string.h>
class BookOrder
{ private:
     char BookID[6];
	 int Quantity;
  public:
	 double Price;
	 void BookInit(char*,int,double);
     void BookInfo(void);
};

void BookOrder::BookInit(char* bh,int sl ,double dj)
{
	strcpy(BookID,bh);
	Quantity=sl;
	Price=dj;
}

void BookOrder::BookInfo(void)
{
	cout<<"编 号\t"<<"数量\t"<<"单价\t"<<"总价"<<endl;
	cout<<BookID<<"\t"<<Quantity<<"\t"<<Price<<"\t"<<Price*Quantity<<endl<<endl;
}

void main()
{
	char number[6];
	int amount;
	double price;
	BookOrder bkorder;
	cout<<"输入订单信息:图书编号、数量、单价"<<endl;
	cin>>number>>amount>>price;
	bkorder.BookInit(number,amount,price);
	cout<<"原单价上的订单内容:"<<endl;
    bkorder.BookInfo();
    bkorder.Price*=0.8;
	cout<<"调整单价后的订单内容:"<<endl;
    bkorder.BookInfo();
}




 


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -