struct Fast_Food_Business
    {
       string name;  
                 Fast_Food_Business* head;
                Fast_Food_business* tail;

                         };

      struct cash_registers{
         Fast_Food_Business * regist;
         cash_registers * r; 

    }

        struct Customer
        { 
           int n;
           Customer * h ; // head
           Customer *t; // tail
           Fast_Food_Business*next;
            };

     bool menu (const char& number)
     {
      return number== '1' ||      number== '2';

                       }

     bool sub_menu (const char& alphabet)
     {
        return alphabet== 'a' ||    alphabet== 'b' ||
           alphabet== 'c' ||    alphabet== 'd' || 
                                   }

     int main()
   {    
    int Restaurant= 0;

    cout<<"How many Restaurants?"<<endl;
    cin>>Restaurants;

    Fast_Food_Restaurant* aRestaurant= new Fast_Food_Restaurant;
    aResturant-> h = NULL;  //top of linked list
    aRestaurant-> t = NULL;  // linked list tail

    for(int i = 1; i < Resturants; i++)
    {   
        aRestaurant -> n = NULL;
        // now add to linked list
        if( aResturant -> h== NULL)  
        {
          aResturant-> h = aRestaurant-> t= aRestaurant;
                                      }
        else
        {
         // add new node to end of linked list
         aRestaurant -> t= aRestaurant-> n = aResturant;
         aResturant -> t= aResturant;
                                       }


                                       }

int customer = 0;
cout " how many customers";
cin>>customer;

      for (int i=0; i<customer; i++)
  { 
     char choice; 
     cout<<"What would be your choice?";
     cin>> choice;

     if( menu(choice))
    {   
        if (menu== '1')
        {

    cash_register * cr = new cash_register;
        cr = NULL;

        if (CR== NULL)
        {
            aResturant = CR; }  


  cin.get();
  return 0;     
}

This is my Code I have now.
So I'm hoping that this code right now does this.

Judging on how many restaurants the user inputs.
It creates that many queues.

Then there are customers.

I want the customers to be able to be able to choose which restaurant they want to go to.

So say if the user types in there are five restaurants.
Then they'll be five restaurant queues.

Is there a way for the user to say, I want to go to restaurant queue 3?

Then when the user chooses something from the menu.
A cash register is created.
Then if the cash register is NULL, then it goes to that restaurant queue, in this case, the cash register goes to restaurant queue 3.

etc.

Could someone point me to the right direction?

Recommended Answers

All 10 Replies

Is there a way for the user to say, I want to go to restaurant queue 3?

Yes, create an array of restaurants and access each 'restaurant' via it's subscript :)

Is it possible doing it with a queue/linked list.

Yes it is.

I been pulling my hair for the past few days.
How could one implement it using queues/linked list?

Using a counter?
And that counter is pointing to a linked list/queue?


Also, how can I have the cash register pointer point to the restaurant pointer?

Should I overload the operator? or something?

I agree with him, the concept is easy.
It's just putting it down on paper that's the hard part.

Do you have a site for queues?

Do you have a site for queues?

You could maybe just try this :) ...

None of them are helpful -><-

None of them are helpful -><-

Google found about 1,860,000 results and none of them are helpful? LOL :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.