Really need some help!!!!

This is a discussion on Really need some help!!!! within the C Programming forums, part of the General Programming Boards category; my final for my programming class....probably really easy for you guys but i have no idea and i d really ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    2

    Really need some help!!!!

    my final for my programming class....probably really easy for you guys but i have no idea and i d really appreciate some help so i dont fail this class haha


    Task write a C program that will provide an interaction similar to the following



    $./myprog

    $promt> what do you want to do today? Enter 1 to sort or 2 to search (Computer)

    $prompt> 1 (user)

    $prompt> how big an array do you want (< 1000) (computer)

    $prompt>100 (user)

    $prompt>Enter 1. To provide input from keyboard, 2. Generate randomly 3. Read from a file (computer)

    $prompt> 2 (user)

    $prompt> Enter 1 to view the sorted array or 2. To write to a file (computer)

    $prompt> 2 (user)

    $prompt>File has been written to outputfile.dat

    $prompt> What do you want to do today? Enter 1 to sort or 2 to search (computer back to the top)

    $prompt> 2 (user)

    $prompt>Is the array to be randomly generated (1) or read from a file (2) (computer)

    $prompt>2 (user)

    $prompt>data read from inputfile.dat (computer will read data from file - 100 integers, between 0-100)

    $prompt> enter the value you want to search (computer)

    $prompt>25 (user)

    $prompt>3 instances found

    $prompt> What do you want to do today? Enter 1 to sort or 2 to search (computer back to the top)

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    And exactly WHAT do you want help with?

    We do not do other peoples homework, but we will help you if you ask direct questions about something in particular (and, no, "How do I write a program to do this" is not a direct question in this case).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    2
    okay...sorry, i didnt expect anyone to do this for me but ive never posted a thread and dont really know where to start.

    i guess where im stuck is - how do you generate random numbers into an array?

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by tmoody View Post
    my final for my programming class....probably really easy for you guys but i have no idea and i d really appreciate some help so i dont fail this class haha
    The thing is, I don't actually care if you fail your class or not. Actually, it's sort of amuses me that you might.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    1 - Read the FAQ on generating random numbers.
    2 - Make an array.
    3 - Put numbers in the array.
    4 - ???
    5 - Possibly pass your class!


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    There is a random number generating function in the standard library. You need to find that. Fill your array with those.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21