|
From: Per W. <pw...@ia...> - 2003-03-20 16:41:08
|
Or just a = 16./3.;
/Per W
On Thu, 20 Mar 2003, Adam Malinowski wrote:
> 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
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Tablet PC.
> Does your code think in ink? You could win a Tablet PC.
> Get a free Tablet PC hat just for playing. What are you waiting for?
> http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|