Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. class Customer{
  2.     private:
  3.     string name;
  4.     string phone;
  5.     Customer *next;
  6.     vector<Customer*> clist = {};
  7.     public:
  8.     Customer(string name,string phone = " ",Customer *next = nullptr):
  9.     name(name),phone(phone),next(next){
  10.     }
  11.     string get_name()const{return this->name;}
  12.     string get_phone()const{return this->phone;}
  13.     Customer get_next(){return this->next;}
  14.     void add_customer(){
  15.        
  16.         cout<<"\nname of customer\t: ";cin >>name;cin.ignore(32000, '\n');
  17.         cout<<"\nphone number: ";cin >>phone;cin.ignore(32000, '\n');
  18.         Customer * c = new Customer{name,phone};
  19.         clist.push_back(c);
  20.      }
  21.    
  22.  
  23.     friend ostream& operator<<(ostream &os, const Customer &c);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement