1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Two Programs I need help with....

Discussion in 'C' started by joebenjamin, Sep 6, 2007.

  1. joebenjamin

    joebenjamin New Member

    Joined:
    Sep 6, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I need help with two programs that are making my week hell lol. I am lost on these two programs, and would like to know if anyone has anything as far as resources or suggestions to these programs:

    Write a program that will read in a time period from the keyboard (for example 1.2 seconds, 3.4 seconds, or 8.37 seconds). Once the time has been read in, print out the word “TICK†and then wait the designated time period and print the word “TICK†again. Repeat until there are 6 “TICKâ€s on the screen. Your output might look like the example below. **Adventurous students could toggle between the words TICK and TOCK. This is a tad harder then it sounds.

    Enter a time ==> 2.27
    TICK <wait 2.27 seconds>
    TICK <wait 2.27 seconds>
    TICK <wait 2.27 seconds>
    TICK <wait 2.27 seconds>
    TICK <wait 2.27 seconds>

    Write a second program that will generate 100 random numbers between 1 and 50. Using these numbers, generate a list that will tell the number of random numbers that fell between 1-5, 6-10, 11-15, 16-20, ... , and 46-50. Print out the results as a histogram (a line representing the number of values). Your output might look like the example below:

    1-5 (11) ***********
    6-10 (8) ********
    11-15 (12) ************
    16-20 (9) *********
    21-25 (10) **********
    26-30 (11) ***********
    31-35 (7) *******
    36-40 (8) ********
    41-45 (13) *************
    46-50 (11) ***********

    Since I am a newbie and there is no book for this class, I turned to this forum for some help. Anything would be appreciated....
    Thanks
     
  2. HowardL

    HowardL New Member

    Joined:
    Aug 5, 2007
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    East Coast USA
    Are you still there?

    If so , let's start with the first assignment.
    You will want to look at the functions in the time.h header.
    They work with your computers clock and can give the abilty to look at time slices from years down to milliseconds. You would get the present time and then check time until the time was that + the wait period.
    See what you can see and come back with questions.
    Howard;
     

Share This Page