Thread: Need Urgent Help

  1. #1
    Registered User
    Join Date
    Aug 2001

    Unhappy Need Urgent Help

    Could someone help me out on this problem in C.
    The rand() fuction is used to genetrate pseudo-random values.Can you write a program that uses the function to simulate people standing in a queue.The probability of someone arriving or departing the queue is 1 in 30 per second.The following function call can be usedto determin if an arrival has occurred.
    rand() % 30 == 0
    Another call function can be made to see if a departure has occured.
    write a program to keep record of the number of people in the queue every second and printing the leghth of queue length each minute.Use loops to simulate the number of minutes and the number of seconds.The program should run for 20 mins.

    I will learn from this its not a cheating thing i need help please Don't Know where to Start.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    how far have you got on your own.....

    you can run the "clock" like this....

    for(int minutes=0;minutes<20;minutes++)
    for (int seconds=0;seconds<60;seconds++)
    // this is where you check for someone entering or leaving the queue and update queues size etc.
    //print queues size

    somewhere near the start of your program you should seed the random number generator with the system time like this:-


    srand ((unsigned)time(null));

    you only have to do this the once!
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Urgent Help Needed In Writing Algorithm!!
    By Vikramnb in forum C++ Programming
    Replies: 1
    Last Post: 01-09-2009, 12:46 PM
  2. beginner plzz help urgent
    By sara101 in forum C Programming
    Replies: 11
    Last Post: 01-14-2007, 10:38 PM
  3. pls help me urgent..
    By intruder in forum C Programming
    Replies: 4
    Last Post: 01-13-2003, 04:41 AM
  4. Help Needed: Borland C++ 5.5 Installation - URGENT!
    By Linette in forum C++ Programming
    Replies: 12
    Last Post: 03-09-2002, 06:44 PM
  5. Help.... Urgent... Thanks!
    By weihann in forum C Programming
    Replies: 0
    Last Post: 02-27-2002, 10:15 PM