title: any way to run 2 loops at the same time?
body: <p>I want to create a c++ program for a bank queue. Where every 3 minutes a new customer enters the queue. every customer needs 5 minutes for the service. The program  print out the information after the first 30 minutes </p>
  
  <ul>
  <li>The time of arriving for each customer </li>
  <li>The time of leaving for each customer </li>
  <li>How many customers are in the line? </li>
  <li>Who is the current serving customer? </li>
  </ul>
  
  <p>I wrote the current code: </p>
  
  <pre><code>#include &lt;queue&gt;
  #include &lt;ctime&gt;
  #include &lt;time.h&gt;
  #include &lt;conio.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
  queue &lt;int&gt; inq;
  queue &lt;int&gt; inservice;
  int z= 1;
  
  for(int i=0; i&lt;=9; i++)
  {
      inq.push(z);
      Sleep(180000);
      _strtime_s(hold_time);
      cout&lt;&lt;"Time of arriving for customer number "&lt;&lt;z&lt;&lt;" is: "&lt;&lt;hold_time&lt;&lt;endl;
      z++;
  }
  
  do
  {
      inservice.push(inq.front());
      Sleep(300000);
      _strtime_s(hold_time);
      cout&lt;&lt;"Time of leaving for customer number "&lt;&lt;z&lt;&lt;" is: "&lt;&lt;hold_time&lt;&lt;endl;
      inq.pop();
  }
  while(!inq.empty());
  
  cout&lt;&lt;"number of customers waiting : "&lt;&lt;inq.size()&lt;&lt;endl;
  cout&lt;&lt;"Customer number "&lt;&lt;inservice.front()&lt;&lt; " is currently serving"&lt;&lt;endl;
  
  return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>The current code executes line by line; customers will not be moved to service until the queue loop is done.
  To adjust time, I have to run the two loops at the same time. such that customers enter the queue at the same time other costumers are being served</p>
  
  <p>Any suggestions ?</p>