User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 397,770 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,531 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 8185 | Replies: 2 | Solved
Reply
Join Date: Jan 2005
Posts: 14
Reputation: dallin is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
dallin dallin is offline Offline
Newbie Poster

Using Division Operator

  #1  
Jan 28th, 2005
In C++ visual studio .net, I'm dividing two integer variables and trying to put the answer in a double variable. How do I get two integers to divide and give me a double data variable answer? Thanks

doub_a = inta / intb
.75 = 9/12
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2004
Posts: 3,462
Reputation: Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light 
Rep Power: 16
Solved Threads: 138
Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Using Division Operator

  #2  
Jan 28th, 2005
Promote one of the operands to double.
   int a = 9, b = 12;
   double d = (double)a / b;
Reply With Quote  
Join Date: Jan 2005
Posts: 14
Reputation: dallin is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
dallin dallin is offline Offline
Newbie Poster

Re: Using Division Operator

  #3  
Jan 28th, 2005
perfect, thanks!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 4:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC