C语言编写“超市结账系统” 急急急!!!

来源:百度知道 编辑:UC知道 时间:2024/06/16 13:12:19
信息描述

商品信息包括:商品编号、商品名称、商品价格、商品数量等
(商品编号不重复)。

功能描述

1从屏幕上读取新商品的信息并将信息存入到数据文件中;

2修改变化了的商品的信息;

3在屏幕上输入顾客所购商品条形码编号;

4在屏幕上显示顾客所购商品清单,货款合计及收款数、找零;

#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <assert.h>

using namespace std;

// Item info base class
class ItemInfo{
public:
ItemInfo(){}
ItemInfo(string barcode, string name, float price)
{
this->barcode = barcode;
this->name = name;
this->price = price;
}
ItemInfo(string barcode)
{
this->barcode = barcode;
}
void Display() {
cout << barcode <<"\t"<<name<<"\t"<<price<< endl;
}
void Input() {
cout << "输入条形码:" << endl;
cin >> barcode;
cout << "输入名称:" << endl;
cin >> name;
cout << "输入价格:" << endl;
cin >> price;
}
vo