What Data type.........

This is a discussion on What Data type......... within the C++ Programming forums, part of the General Programming Boards category; Hello! What data type should I use to declare variables that hold fractions ?? I've looked everywhere, but can't find ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    42

    What Data type.........

    Hello!

    What data type should I use to declare variables that hold fractions ??

    I've looked everywhere, but can't find an answer.



    <my geometric calculator will be ready in few hours!>
    Last edited by Nectron; 07-10-2003 at 07:33 AM.
    I have a code which stops life!

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Floats or doubles.

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Take a look at the boost library or write your own rational numbers class. Thats a simple enough exercise.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  2. Can you check what is wrong with this code
    By Ron in forum C++ Programming
    Replies: 4
    Last Post: 08-01-2008, 11:59 PM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  4. C diamonds and perls :)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 11:19 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 07:49 PM

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