|
-
August 30th, 2009, 03:02 AM
#1
Simple C++ question
How would I code the negative value of an if else function? Would I just have to convert 1 x 10-5 to a decimal value?
if (x > 1 x 10-5)
{
cout << "Value" << endl;
{
else
-
August 30th, 2009, 03:11 AM
#2
Re: Simple C++ question
can you eleobrate your problem in more detail
-
August 30th, 2009, 03:13 AM
#3
Re: Simple C++ question
Well the complier won't complie past
if (x > 1 x 10-5)
Would I have to convert the 1 x 10-5 to a decimal value or is there another way ?
-
August 30th, 2009, 03:18 AM
#4
Re: Simple C++ question
 Originally Posted by Guru_Kid
Would I have to convert the 1 x 10-5 to a decimal value or is there another way ?
The expression 1 x 10-5 does not make sense. What exactly are you trying to compare?
-
August 30th, 2009, 03:27 AM
#5
Re: Simple C++ question
if you want to multiply 10 with 1 and then subtract 5 . then use *
to get decimal value of 1 x 10-5 can be calculated 1*10-5
-
August 30th, 2009, 04:51 AM
#6
Re: Simple C++ question
 Originally Posted by Guru_Kid
Well the complier won't complie past
if (x > 1 x 10-5)
Would I have to convert the 1 x 10-5 to a decimal value or is there another way ?
Looks you are asking about standard form, 1E-5. Read up on floating point numbers, in C++ you can used float or double to store such numbers.
Rich
Visual Studio 2010 Professional | Windows 7 (x64)
Ubuntu
-
August 30th, 2009, 08:11 AM
#7
Re: Simple C++ question
 Originally Posted by Guru_Kid
How would I code the negative value of an if else function? Would I just have to convert 1 x 10-5 to a decimal value?
if (x > 1 x 10-5)
{
cout << "Value" << endl;
{
else
It's hard to tell your intent but maybe you mean
if (x > (1 * (10-5)))
-
August 30th, 2009, 08:35 AM
#8
Re: Simple C++ question
He means 1e-5, I'm fairly sure.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|