?? bookorder.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 + -