serious help on a program

This is a discussion on serious help on a program within the C++ Programming forums, part of the General Programming Boards category; on monday i have a program due that converts dollars to deutsche marks and francs, we were given these formulas ...

  1. #1
    aly
    aly is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    1

    Thumbs down serious help on a program

    on monday i have a program due that converts dollars to deutsche marks and francs, we were given these formulas
    $1.00=5.05 Fr
    $1.00=1.47 DM
    1.00= 3.4354 Fr

    The problem is that i am really just learing c++ am entirely confused..unsure even where to begin...if anyone could possibly lend some advice to me i would be very very grateful..again this is due monday thanks so much...

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Please have a look at my code for help, and then attempt it yourself. Otherwise he might be suspicious of cheating and/or you'll never learn C. I'd normally flame, but I'm in a good mood [tired].

    Code:
    #include <stdio.h>
    #define FRANKS 5.05 
    /* this means anytime you type FRANKS, it is replaced with 5.05 */
    #define DM 1.47 
    /* same here except with DM */
    
    int main(void) 
    {
      float input;
      int choice;
      printf("Enter amount in dollars $"); 
      scanf("%f",&input); 
    /* get the floating point (%f) input, this is a number with a 
    decimal point (although it doesnt need one) */
      printf("Convert to (1)Franks or (2)Deutsche Marks? >");
      scanf("%d",&choice); 
    /* get a decimal integer (%d) input, no decimal point */
      if(choice == 1)
       printf("$%.2f = %.2fF",input,input*FRANKS); 
    /* * is the symbol for multiplication */
      else if(choice == 2)
       printf("$%.2f = %.2fDM",input,input*DM);
      else
       printf("Invalid choice.");
      return 0;
    }
    Last edited by Brian; 02-24-2002 at 02:08 AM.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    u can use functions!

  4. #4
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Originally posted by pode
    u can use functions!
    I know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  3. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  4. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 11:58 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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