Thread: Need help with a array program

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    1

    Need help with a array program

    i need help wit the logic to write the program.

    Design an algorithm that takes an array of five (5) double data type elements, which represent exchange rates (e.g. U.S. Dollar->E.U. Euro), and use a switch statement to display/output that number. Use a random number function in C (this will require the randomize() function too) to pick what case to use.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum, antim!

    Use the same logic you would use to do this, by pencil and paper.
    The logic is the same. What specifically, has you stumped?

  3. #3
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Are you stumped about the "do my homework" rules, the "read forum rules before posting" or writing in ENGLISH and not SMS speak ?
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 03-02-2011, 07:35 PM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Array Program
    By alex1067 in forum C Programming
    Replies: 5
    Last Post: 04-15-2008, 06:26 AM
  4. Type and nontype parameters w/overloading
    By Mr_LJ in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2004, 01:01 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM

Tags for this Thread