书店会员系统c++代码
答案:2 悬赏:0 手机版
解决时间 2021-03-08 02:12
- 提问者网友:星軌
- 2021-03-07 08:44
书店会员系统c++代码
最佳答案
- 五星知识达人网友:人類模型
- 2021-03-07 09:41
#include #include using namespace std;class Sales_data{ friend istream &operator>>(istream &, Sales_data &); friend ostream &operator> *this; }public: Sales_data &operator +=(const Sales_data &); string isbn() const { return bookNo; }private: string bookNo; unsigned units_sold = 0; double sellingprice = 0.0; double saleprice = 0.0; double discount = 0.0;};bool compareIsbn(const Sales_data &lhs, const Sales_data &rhs){ return lhs.isbn() == rhs.isbn();}Sales_data operator + (const Sales_data &, const Sales_data &);bool operator==(const Sales_data &lhs, const Sales_data &rhs){ return lhs.units_sold == rhs.units_sold && lhs.sellingprice == rhs.sellingprice && lhs.saleprice == rhs.saleprice && lhs.isbn() == rhs.isbn();}bool operator!=(const Sales_data &lhs, const Sales_data &rhs){ return!(lhs == rhs);}Sales_data &Sales_data::operator+=(const Sales_data &rhs){ units_sold += rhs.units_sold; saleprice = (rhs.saleprice * rhs.units_sold + saleprice * units_sold) / (rhs.units_sold + units_sold); if (sellingprice != 0) discount = saleprice / sellingprice; return *this;}Sales_data operator+(const Sales_data &lhs, const Sales_data &rhs){ Sales_data ret(lhs); ret += rhs; return ret;}istream &operator>>(istream &in, Sales_data &s){ in >> s.bookNo >> s.units_sold >> s.sellingprice >> s.saleprice; if (in && s.sellingprice != 0) s.discount = s.saleprice / s.sellingprice; else s = Sales_data(); return in;}ostream &operator> book) { cout > trans1 >> trans2; if (compareIsbn(trans1, trans2)) cout > total) { while (cin >> trans) if (compareIsbn(total, trans)) total += trans; else { cout > trans1) { while (cin >> trans2) if (compareIsbn(trans1, trans2)) num++; else { cout << trans1.isbn() << "共有" << num << "条销售记录" << endl; trans1 == trans2; num = 1; } cout << trans1.isbn() << "共有" << num << "条销售记录" << endl; } else { cout << "没有数据" << endl; return -1; } return 0;}
全部回答
- 1楼网友:神的生死簿
- 2021-03-07 10:00
简单说下思路:
去图书馆借本vc6.0的书,再借本项目实践的书,运气好的话,上面直接有程序,再运气好的话,书上附有光盘,里面有完整的程序。我见过这个程序,在图书馆
自己做也不难,用acc做数据库,odbc连上,不难
碰到问题自己解决,不要老是到这里来,给高分,让人替你做
谁也替不了你你所有的,好运
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯