|
|
If both of the numbers are of type int like they stated then you'll get (On Visual C++ 6.0 and VC++ 2003)
#include "stdafx.h"
int main(int argc, char* argv[])
{
int x=1;
int y=9;
printf("%f\n",x/y); // The expression gets truncated before formatting
printf("%lf\n",x/y); // The expression gets truncated before formatting
printf("%f\n",(double)x/y); // The correct way when both are integers
printf("%lf\n",(double)x/y); // The correct way when both are integers
return 0;
}
*************** OUTPUT VC++ 6.0*******************
-1.#QNAN0
-1.#QNAN0
0.111111
0.111111
Press any key to continue
*************** OUTPUT VC++ 6.0*******************
796482944349676280000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000.000000
796482944349676280000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000.000000
0.111111
0.111111
Press any key to continue
|
|
|
|
|
Don't forget to make sure at least one of the components in the expression is a float or a double to avoid truncations. If both x and y are int's you will notice a truncation of the result before the printf formatting occurs.
printf("%f\n",(double)x/y);
|
|
|
|
|
See
<br />
double c;<br />
double x = 123.456;<br />
double y = 2.1;<br />
c=x/y;<br />
printf( "%f\n", c);
whitesky
|
|
|
|
|
|
One slight correction: Use the "%f " format code for values of type float , and "%lf " format code for values of type double .
Software Zen: delete this;
|
|
|
|
|
anybody knows how to repair a floppy??Plz giv some implementation..
|
|
|
|
|
Do you want to create this utility or just need a tool for doing this
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I am already in the rocess of makin this utility ,but some ppl say that they move bad sectors in damaged floppies!! How can we do that? We can just indicate the OS that the sector is bad ,we cant move it here n there around.So I just wanted to confirm this thing. I hav tried my programs on several floppies n 8/10 hav been suceessfully repaired .But anyways Thanks .
|
|
|
|
|
|
Hey , Listen
CFlopy is just to read from a floppy , onthing else OK. It is not a floppy repairer . If u dont know the answer ,then stop guessing.
|
|
|
|
|
No, you listen. He suggested you look at an article related to your question. It might have had information that was useful to you, even though it didn't solve your problem directly. Your response is rude and uncalled for.
Software Zen: delete this;
|
|
|
|
|
Thank you for support
whitesky
|
|
|
|
|
You're welcome.
Normally I don't correct other people's behavior in public, but ingratitude is one of my hot buttons.
Software Zen: delete this;
|
|
|
|
|
I am here (usualy only visual c fourm)for answer to questions and you know that i can dont answer to any question and i see questions(only) but i like answer to questions becuase i want help to programers
whitesky
|
|
|
|
|
how can we detect bad sectors in a floppy??PLz tell with some implementation!!
|
|
|
|
|
Have you tried "chkdsk" command? It checks and fixes bad sectors on a drive.
- It's easier to make than to correct a mistake.
|
|
|
|
|
Is it possible to center align the subitem image (no text in subitem) in a List control (CListCtrl)? CListCtrl::SetItem() doesn't seem to do so. Help please!
|
|
|
|
|
SeeHere[^] im not sure but maybe it is some helpful to you
whitesky
|
|
|
|
|
Yes I have seen that before but that is owner draw list and I have to use normal list control.
Thanks for your input.
|
|
|
|
|
Hi,
i m getting this error, does anyone know hot to fix ?
[Linker Error] Fatal: Error detected (IMP302)
[Linker Error] Fatal: Access violation. Link terminated.
Software Development Specialist
|
|
|
|
|
It is internal compiler error, try to 'Rebuilt All' it may help.
Here someone has the same problem.
|
|
|
|
|
i want to creat a form with button that have nonectangular shape , such circle ,...
how i can do it?
erfan
|
|
|
|
|
|