资源简介
c++ pos机///小学期的作业

代码片段和文件信息
#include
#include
#include
using namespace std;
struct Goods
{
int num;
string name;
double price;
int e_count;
int count;
};
int main()
{
Goods g[20];
ifstream file;
ofstream FQ;
string temp;
double m;
int t;
file.open(“清单.txt“);
for(int i=0;i<20;i++)
if(!file.eof())
{
file>>t;
g[i].num=t;
file>>temp;
g[i].name=temp;
file>>m;
g[i].price=m;
g[i].count=0;
g[i].e_count=0;
}
file.close();
char ch1ch2;
Goods temp2;
double sume_sumpay;
sum=e_sum=0;
ch1=ch2=‘y‘;
F.open(“明细.txt“);
F<<“编号\t名称\t单价\t数量\n“;
while(ch1==‘y‘)
{
while(ch2==‘y‘)
{
cout<<“请输入商品的编号与数量:“< cin>>t>>m;
temp2.num=t;
temp2.e_count=m;
for(int i=0;i<20;i++)
if(temp2.num==g[i].num)
{
temp2.name=g[i].name;
g[i].count+=temp2.e_count;
temp2.price=g[i].price;
break;
}
e_sum+=temp2.price*temp2.e_count;
cout<<“continue?y/n“< cin>>ch2;
F< }
F<<“总计:“< cout<<“总计:“< sum+=e_sum;
cin>>pay;
cout<<“找零:“< cout<<“下一个顾客?y/n“< cin>>ch1;
e_sum=0;
ch2=‘y‘;
}
F.close();
Q.open(“每日.txt“);
Q<<“编号\t名称\t单价\t数量\n“;
cout<<“名称\t数量\t总计\n“;
for(int j=0;j<20;j++)
{cout< Q< }
Q<<“总营业额为:“< Q.close();
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 360 2011-07-03 17:44 每日.txt
文件 127 2011-07-03 17:44 明细.txt
文件 1707 2011-07-03 17:43 text.cpp
文件 380 2011-07-03 15:59 清单.txt
----------- --------- ---------- ----- ----
2574 4
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
评论
共有 条评论