class - How to show and add data with Single Linked list object in C++ -


i want make class called bike elements name, height , color want associate single linked list. program return price of bike.

i want user able enter 5 bikes.

i confused part have add bike data , show them.

this have far. can please guide me through.

#include <iostream> using namespace std;   class bike { private:     string* name;     string color;     double height;     double price;     bike * node; public:     void entry(bike *head);     void display(bike *current);     void quit();     void initializeobject(); };    void bike::entry(bike *head) {     bike obj;     obj.initializeobject();     head = &obj; }  void bike::display(bike *current) {     cout << "the list contains :";     while (current != null)     {         cout << current->head;         current = current->next;     }  } 

make different class multiple bikes.
example:

class bike { public: string name; ... /*..data , functions single bike..*/ }  class bikes { bike *head; public: void entry(bike); .... /* functions */ } 

in main() function have use bikes class.


Comments