Thread: Dividing fractions help!!!

  1. #1
    Staractor6
    Guest

    Dividing fractions help!!!

    hey i've been taking a C++ class for half a school year and i need help on writing thois program for HW....the question is....Given Fractions a/b and c/d (a,b,c,d integers, b+d not zero) print in lowest terms the quotient of a/b divided by c/d.....first test if b or d=0................since i have only learned basic stuff i'd have to do this in void functions with parameters and also loops. please help by writing this program for me as basic as you can.........thanks

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    tell ya wat, try and do it yourself, show some effort, then come back...

  3. #3
    Staractor6
    Guest
    well i have sorta an idea wat to do........i need a do while loop to make sure b and d ==0 and i need. how do i divide fractions tho? and how would i check to see if i was in lowest terms?

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    20
    hi,
    you probably know this already. But to divide functions, you would write it like any other math function in C++
    e.g a=4/3;
    except now your using variables.
    as for your test statement, I'm not sure why you have to use a while loop, but you could just use an if statement.
    hope that helped.
    Good luck

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    to give you a hint, if you forgot, dividing fractions can be done by multiplying reciprocals.

    by the way, people on this board won't do your homework, try it, post code, and we'll be glad to help, but to write the program for you is not an option, and it is also cheating.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fractions
    By zdream8 in forum C Programming
    Replies: 2
    Last Post: 05-21-2008, 09:54 PM
  2. Greatest Common Factors of Fractions
    By sonict in forum C++ Programming
    Replies: 1
    Last Post: 01-15-2003, 04:33 AM
  3. Dividing int numbers by 256, but fast!
    By Boksha in forum C++ Programming
    Replies: 4
    Last Post: 04-04-2002, 03:44 PM
  4. Fractions
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2002, 07:51 AM
  5. Decimals to Fractions
    By ToasterPas in forum C++ Programming
    Replies: 4
    Last Post: 12-28-2001, 12:58 PM