Reputation: 11 Tradesman
- Active Members
- Active Posts:
- 59 (0.05 per day)
- 03-November 11
- Profile Views:
- Last Active:
- Feb 26 2014 04:29 AM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 15 Feb 2014Hi,
As Salem_c said,
QuoteBecause floating point input understands exponentiation format.
Like 1.23e+2 is really 123
But if you don't type in the rest of it, then what ends up in unit is the \n of the end of input.
You don't have a case for that, so it ends up as the default.
try to run your program by inputting 1.23e+2e. This is equal to 123e which is what you really want. If you want to convert say 300 euros, you'll have to type in 3.0e+2e which will become 300e. Notice that the e in red is actually the exponential form and the e in green is the char unit from the user input.
read jimblumberg post to understand why your input say, 12ee, 55es, or 32.2e y would not work.
I were a little too fast when I first read jimblumberg's post, I get it now. Thanks!
Posted 15 Feb 2014
QuoteI thought so too at first, but shouldn't input like 12ee, 55es, or 32.2e y work then?
What results did you get when you ran the program?
"12ee" should produce 12.0, "55es" should produce 55.0, "32.2e y" should produce 32.2 all the extra characters will be left in your input buffer waiting for the next input operation.
I know, but all those things evaluate to the default case.
I just tried compiling it with g++, and I get the same results.
Posted 15 Feb 2014I thought so too at first, but shouldn't input like 12ee, 55es, or 32.2e y work then?
Posted 26 Aug 2013You should also know that you have to think in different ways depending on CPU, not only different instructions. CPUs have different addressing modes, different amount of registers, status flags reacting differently to op-codes, e.t.c.
Posted 13 Aug 2013
QuoteYou should change that NULL to nullptr.
But remember that nullptr is only available with the C++11 standard, it doesn't exist in the C++98 standard.
Isn't using C++98 now like using something like Turbo C++ when C++98 were the standard?
I know it's not THAT bad, but it's still in the same direction, right?
- Member Title:
- D.I.C Head
- Age Unknown
- Birthday Unknown
DoNotWant hasn't added any friends yet.