ex11-02.cpp
来自「数据结构常用算法合集」· C++ 代码 · 共 27 行
CPP
27 行
//EX11-02.cpp
#include <iostream.h> //cout,cin
#include <conio.h> // getch()
struct rec
{ char item[5];
char name[20];
float unit_price;
short quantity;
char customer_no[5];
} sale;
void main()
{ short i;
float total=0;
for (i=0;i<5;i++)
{ cout <<"customer_no=";cin>>sale.customer_no;
cout <<"Item=";cin>> sale.item;
cout <<"name=";cin>>sale.name;
cout <<"unit_price=";cin>>sale.unit_price;
cout <<"quantity=";cin>>sale.quantity;
total += sale.unit_price * sale.quantity;
}
cout << "\ntotal ="<<total;
getch();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?