div_t to integer

This is a discussion on div_t to integer within the C++ Programming forums, part of the General Programming Boards category; How can I assign a div_t value i found using the div function (with 2 integers) to a integer? For ...

  1. #1
    Unregistered
    Guest

    div_t to integer

    How can I assign a div_t value i found using the div function (with 2 integers) to a integer? For example:
    Code:
    int r;
    div_t d;
    
    d = div(10, 3);
    r = d;
    Wont work. How can i make it work? Thanks!

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    http://www.cplusplus.com/ref/cstdlib/div.html

    It depends... what is it that you want to do? Assign the int to the remainder, or to the quotient?

    r = d.quot;
    r = d.rem;
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    249

    You gave it both...

    s/he will use them both since s/he know them both....
    C++
    The best

  4. #4
    Unregistered
    Guest
    Ok, thank you it worked.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-20-2009, 11:37 PM
  2. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 05:55 PM
  3. Looking for constructive criticism
    By wd_kendrick in forum C Programming
    Replies: 16
    Last Post: 05-28-2008, 09:42 AM
  4. No Match For Operator+ ???????
    By Paul22000 in forum C++ Programming
    Replies: 24
    Last Post: 05-14-2008, 10:53 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM

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