|
From: Adam M. <up...@in...> - 2003-03-20 16:09:44
|
Hi.
It' simple.
> a=16/3;
16 an 3 are integer values so reult is also integer value.
If you do somthing like that:
float b=16, c=3;
a = b/c;
it will work fine.
Or you can try:
a = (float)16/(float);
Regards.
Adam
----- Original Message -----
From: "francesca " <pin...@li...>
To: <dev...@li...>
Sent: Thursday, March 20, 2003 4:28 PM
Subject: [Dev-C++] help float
> Hi,
> I use Dev-C++ 9.7.0 OS Win 2000.
> When I write simply:
>
> #include <iostream>
> #include <stdio.h>
> #include <stdlib.h>
> using namespace std;
>
> main()
> {
> float a;
> a=16/3;
> cout<<a<<endl;
> system("PAUSE");
> return 0;
> }
>
> the compilation finishes correctly, but the program visualizes only 5
without decimates them!
> why?
>
> Any help is appreciated
>
> francesca
> --
----------------------------------------------------------------------
WOJNA stala sie faktem! RELACJE jedynych polskich dziennikarzy w Iraku.
>>> http://link.interia.pl/f16f7
|