Author Topic: cant use double vars  (Read 5375 times)

Offline mnorman

  • Single posting newcomer
  • *
  • Posts: 2
cant use double vars
« on: October 30, 2013, 03:22:09 am »
I downloaded both the newest (12.I forget) and 10.05 versions of codeblocks on my windows 7 64bit laptop. Whenever I try and do any sort of operation with a double type variable (print, scan, any sort of math), even if it is initialized to something, the result always comes up as 0.00000000. Anyone got any ideas?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: cant use double vars
« Reply #1 on: October 30, 2013, 03:50:32 am »
I downloaded both the newest (12.I forget) and 10.05 versions of codeblocks on my windows 7 64bit laptop. Whenever I try and do any sort of operation with a double type variable (print, scan, any sort of math), even if it is initialized to something, the result always comes up as 0.00000000. Anyone got any ideas?

User Error; I suggest going to another site like http://cboard.cprogramming.com/forum.php
And, post your bad code and ask for help.

Please re-read the rules! http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline mnorman

  • Single posting newcomer
  • *
  • Posts: 2
Re: cant use double vars
« Reply #2 on: October 30, 2013, 06:50:04 am »
believe me its not user error

double i = 9.4;

printf ("%lf", i);

prints 0.0000000, I don't mean to sound argumentative but I've gone through everything I can find on alternative ways for printing doubles. I can use ints and chars with no issues just doubles are not functioning.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: cant use double vars
« Reply #3 on: October 30, 2013, 07:28:58 am »
I downloaded both the newest (12.I forget) and 10.05 versions of codeblocks on my windows 7 64bit laptop. Whenever I try and do any sort of operation with a double type variable (print, scan, any sort of math), even if it is initialized to something, the result always comes up as 0.00000000. Anyone got any ideas?

User Error; I suggest going to another site like http://cboard.cprogramming.com/forum.php
And, post your bad code and ask for help.

Please re-read the rules! http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.

To be more precise than Tim:
User or compiler error (the second is very unlikely).
In both cases it has nothing to do with C::B and it shows, that you did not read (or understand) the rules, even after Tim has posted the link for you.

Be aware that you violate our forum rules and that such posts might get deleted (or locked) silently without comment.

[...]
1. This is NOT a general programming board. "How do I write a program that....", "Can anybody teach me how to", "I have this homework", "My program doesn't run and I don't have the slightest idea of why because I'm a C++ newcomer", "What is a compiler", "What does gcc do" is the kind of questions that is FORBIDDEN to ask.

2. Compiler/Linker errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.

[...]

Finale note: Ignoring these rules may result in the topic being (silently) locked and/or even removed completely without any notice.

[...]

Please respect the rules in the future !

Topic locked !

Nevertheles, your code runs fine on my machine (linux 64-bit with gcc4.8).