Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:36:09+00:00 2026-06-13T16:36:09+00:00

I am working on an exercise on C++ which demands to simulate a service

  • 0

I am working on an exercise on C++ which demands to simulate a service queue and it asks to do it with a round,one dimension array.So it demands, when a customer comes to insert in the queue his name, the number of his card and the arrival time in the queue.

So my first question is how can I enter all these elements in one position of the array?(I don’t know if it is called cell of array or position,English is not my native) Each customer will have to occupy only one position of the array and I have to insert all of his info in one position. I already know the conditions on how to insert or extract an element from a round queue I just don’t know how to do it for lots of them.

Secondly it asks to print how much time the customer has to wait in queue depending on how much people are waiting before him (it doesn’t have to be too precise though).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:36:10+00:00Added an answer on June 13, 2026 at 4:36 pm

    For the first question: Could you create a class or struct representing the collection of data, and put the entire struct into your container?

    (Edit: Customer is now a class, has a constructor; added example of instantiation)
    You’ll want to clean this up a little, but something like:

    class Customer {
    private:
      std::string m_name;
      int m_card_number;
      int m_arrival_time;
    public:
      Customer() : m_card_number(0), m_arrival_time(0) { } // might need default ctor
    
      Customer(const std::string name, int card_number, int_arrival time)
      : m_name(name), m_card_number(card_number), m_arrival_time(arrival_time)
      { }
    };
    
    std::dequeue<Customer> service_queue; // or your container here
    
    Customer c = Customer(name, card_num, current_time);
    service_queue.push_back(c);
    

    For the second question; if you don’t need to persist the time, and only need to work with differences, one solution is to use clock. Just don’t forget to divide by CLOCKS_PER_SECOND once you take your time difference (in ticks) and need to convert to seconds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an exercise which asks me to take a base class
i'm working through SICP - one exercise is to implement foreach (doseq). This is
This is one of my homework exercise. Write a shell program, which will take
The RailsTutorial Exercise 10.5.7 asks me to insert a character counter for the micropost
Am working on a tutorial exercise on Cocoa in which a nib file containing
I'm currently working through some exercises in a c++ book, which uses text based
So I've been working the last exercise of Learn Python the Hard Way and
I'm currently working on a self-teaching exercise in programming in C# to make an
I'm working on a small MVC framework in PHP for an exercise. PHP, however,
I'm working on building a pretty simple site mainly as an exercise in learning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.