Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › visual c++ - can't add int or doubles
New Posts  All Forums:Forum Nav:

visual c++ - can't add int or doubles

post #1 of 8
Thread Starter 
For my final project and I only have about a half more class to work on it. When I add up a bunch of other doubles it gives me an error about binary+ something something cant do this something. I decalred the variable like double^ variable or int^variable. Sense the doubles weren't working I changed some of them to integers and that didn't help either. Bascially the doubles were the prices of stuff. Halp.
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
post #2 of 8
Well make sure you don't mix int's with doubles, or you get weird results.
I Love Cheese
(13 items)
 
  
CPUMotherboardGraphicsRAM
2600k @ 3.4 Asus P8P67 Basic XFX 5970 2 gig Black Edition 2x 4 gig DDR 1600 G-Skill 
Hard DriveOSMonitorPower
2x500 gig WD Vista Ultimate 64-bit Dual 25" Hannspree LCD CM 750 Watt 
CaseMouse
Rosewill THOR Logitech Trackball 
  hide details  
Reply
I Love Cheese
(13 items)
 
  
CPUMotherboardGraphicsRAM
2600k @ 3.4 Asus P8P67 Basic XFX 5970 2 gig Black Edition 2x 4 gig DDR 1600 G-Skill 
Hard DriveOSMonitorPower
2x500 gig WD Vista Ultimate 64-bit Dual 25" Hannspree LCD CM 750 Watt 
CaseMouse
Rosewill THOR Logitech Trackball 
  hide details  
Reply
post #3 of 8
Without a sample of your code, we can't tell what you're talking about.
post #4 of 8
Yeah, a code sample would be nice. You may have to cast the int's into doubles
Main Rig
(15 items)
 
 
Living Room PC
(12 items)
 
CPUMotherboardGraphicsRAM
i7 4790K @ 4800 G1 Sniper 5 GTX 780Ti SLI @ 1300MHz 16GB DDR3 @ 2200 9-11-11-31 1T 
Hard DriveHard DriveOptical DriveCooling
2TB Hitatchi HDD 1TB Samsung 840 EVO samsung DVDRW DL Custom Water loop 
OSMonitorPowerCase
Win7 64 LG 27" 1080p EVGA 1000P Corsair 700D 
CPUMotherboardGraphicsRAM
i7 3770K @ 5000 Z77X-UP7 GTX770 2x4GB DDR3 7-8-7-21 1T 
Hard DriveHard DriveOptical DriveCooling
WD Velociraptor 250GB 840Evo DVD Burner Coolermaster hyper 212+ 
OSPowerCase
Win 7 x64 OCZ GameXtreme 700W  Dimastech mini v1 
CPUMotherboardGraphicsRAM
i7 2600 Asus P8Z77-V Pro GTX580 8GB DDR3 @ 1600 9-9-9 1T 
Hard DriveHard DriveOptical DriveCooling
2TB hitachi 500GB 850EVO Blue Ray Hyper 212+ 
OSMonitorPowerCase
Win7 64` 42" Panasonic Plasma TX650 Tuniq Tower 3 
  hide details  
Reply
Main Rig
(15 items)
 
 
Living Room PC
(12 items)
 
CPUMotherboardGraphicsRAM
i7 4790K @ 4800 G1 Sniper 5 GTX 780Ti SLI @ 1300MHz 16GB DDR3 @ 2200 9-11-11-31 1T 
Hard DriveHard DriveOptical DriveCooling
2TB Hitatchi HDD 1TB Samsung 840 EVO samsung DVDRW DL Custom Water loop 
OSMonitorPowerCase
Win7 64 LG 27" 1080p EVGA 1000P Corsair 700D 
CPUMotherboardGraphicsRAM
i7 3770K @ 5000 Z77X-UP7 GTX770 2x4GB DDR3 7-8-7-21 1T 
Hard DriveHard DriveOptical DriveCooling
WD Velociraptor 250GB 840Evo DVD Burner Coolermaster hyper 212+ 
OSPowerCase
Win 7 x64 OCZ GameXtreme 700W  Dimastech mini v1 
CPUMotherboardGraphicsRAM
i7 2600 Asus P8Z77-V Pro GTX580 8GB DDR3 @ 1600 9-9-9 1T 
Hard DriveHard DriveOptical DriveCooling
2TB hitachi 500GB 850EVO Blue Ray Hyper 212+ 
OSMonitorPowerCase
Win7 64` 42" Panasonic Plasma TX650 Tuniq Tower 3 
  hide details  
Reply
post #5 of 8
Thread Starter 
It's at school so I don't have anything. It was all doubles though. Like this:
double^ var1
double^ var2
double^ var3
double^ var4
double^ total
total = var1+var2+var3

Also when I switched some to ints I only tried to add the ones that were ints. Another thing, where should I put the line for the total. Basically theres a bunch of radio buttons on different tabs and you choose one and that gives, say, var1 a number. If I put it in the part of the radio button then they choose something different, the price would be messed up. I was thinking about clicking a button to do it becuase I can't think of any other way.
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
post #6 of 8
Thread Starter 
Anyone?
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
post #7 of 8
Thread Starter 
Ok nevermind. I just changed it to floats and it worked.
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
q6600 @ 3.4 ep45-ds3r gtx 280 4gb ocz 1066 
Hard DriveOptical DriveOSMonitor
2 500 1 750 black 2 2tb green wd dvd-rw dvd-rom win 7 24" 15" lcd 19" crt vivitek h1080fd projector 
KeyboardPowerCaseMouse
logitech k120 1kw antec haf 932 g500 
Mouse Pad
xtrac 
  hide details  
Reply
post #8 of 8
For your reference, this is called Managed C++. Visual C++ is an IDE. Managed C++ is the .NET language developed by Microsoft based on the C++ syntax.

Because managed C++ is different to ISO/ANSI C++, if you do not make this clear you may not get the answers you want quickly. (I use Visual C++ to write "unmanaged" C++)

I suspect the problem is because of the pointers you are using ("double^"). If you changed it to "float" then you aren't using pointers, and this fixes the problem of dereferencing. If you switched to "float^" then you are probably hiding the problem of 32bit vs 64bit pointers and should keep looking for the problem, as well as testing it on both 32 and 64 bit compiled as "AnyCPU".
Serene Power
(13 items)
 
  
CPUMotherboardGraphicsRAM
Dual Xeon E5620 Supermicro X8DAL-i EVGA 570HD SC 8GiB Corsair DDR3 1333 ECC-R 
Hard DriveOptical DriveOSMonitor
OCZ Agility 3 120GB SSD (+16TB NAS) LG 10x Blu-Ray Windows 7 x64 / Debian x64 Dell 2408WFP, P2411H 
PowerCase
850W CoolerMaster SilentPro M CoolerMaster Cosmos Pure 
  hide details  
Reply
Serene Power
(13 items)
 
  
CPUMotherboardGraphicsRAM
Dual Xeon E5620 Supermicro X8DAL-i EVGA 570HD SC 8GiB Corsair DDR3 1333 ECC-R 
Hard DriveOptical DriveOSMonitor
OCZ Agility 3 120GB SSD (+16TB NAS) LG 10x Blu-Ray Windows 7 x64 / Debian x64 Dell 2408WFP, P2411H 
PowerCase
850W CoolerMaster SilentPro M CoolerMaster Cosmos Pure 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › visual c++ - can't add int or doubles