1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#pragma once
#include <string>
#include <vector>
using namespace std;
class Order
{
protected:
string name;
string address;
string data;
char delim, delim1,delim2;
public:
Order()
: name{ "" }, delim{ ';' }, address{ "" }, delim1{ ';' }, data{ "" }, delim2{ ';' } {};
Order(string name1, string address1, string data1)
: name{ name1 }, delim{ ';' }, address{ address1 }, delim1{ ';' }, data{ data1 }, delim2{ ';' } {};
~Order() {};
string get_name() const { return name; };
string get_address() const { return address; };
string get_data() const { return data; };
char get_delim() const { return ';'; };
};
class Purchase : Order
{
private:
string product;
double unit_price;
int count;
public:
Purchase()
: product{ "" }, unit_price{ 0.0 }, count{ 0 } {};
Purchase(string product1, double unit_price1, int count1)
: product{ product1 }, unit_price{ unit_price1 }, count{ count1 } {};
~Purchase() {};
string get_product() const { return product; };
double get_unitprice() const { return unit_price; };
int get_count() const { return count; };
};
istream& operator>>(istream& is, Order& o);
ostream& operator<<(ostream& os,const Order& o);
istream& operator>>(istream& is, Purchase& p);
ostream& operator<<(ostream& os, const Purchase& p);
void orders_from_file(vector<Order>& o);
void orders_to_file(const vector<Order>& o);
void orders_vec_print(const vector<Order>& o);
|