Re: [Dev-C++] Rounding off Floating Point numbers
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Eric <eri...@wo...> - 2008-04-09 06:41:42
|
Attention Group
Is it possable to add a bit of class to the group my name is Eric, I am not too sure why the "bro" after all we are not in a Email group for coal miners .
If you would like me to help you with the C++ request I hope I enjoy taking out time to help you.
While I am not up to speed to Per Westermark standards of C++, some times the someone elses answer come together with the question as I mainly get Email twice a day, The question to this thread came about midnight when I down loaded emails, I went to bed late so I could answer the question, I was not too sure if it was C or C++ or a hybrid question (C and C++ combined)
Thankyou from Eric
----- Original Message -----
From: Deepesh Kapadia
To: dev...@li...
Sent: Wednesday, 09 April, 2008 4:59 PM
Subject: Re: [Dev-C++] Rounding off Floating Point numbers
I want it for c++ bro...
On 4/9/08, Eric <eri...@wo...> wrote:
Ummmm did you want the answer for c or c++
here it is for C, try this out
=================================
#include <cstdlib>
#include <iostream>
float x=1;
using namespace std;
int main(int argc, char *argv[])
{
cout << "1/3 =" << x/3 << "\n";
printf("1/3 = %.9f \n", x/3);
system("PAUSE");
return EXIT_SUCCESS;
}
==============================
printf("1/3 = %.9f \n", x/3);
the %.9f will give the answer to 9 decimal places
>From Eric
----- Original Message -----
From: Deepesh Kapadia
To: dev...@li...
Sent: Tuesday, 08 April, 2008 9:28 PM
Subject: [Dev-C++] Rounding off Floating Point numbers
Hello,
I would like to know if i have a value held in a float variable, how would I
fix the value to one decimal place???
I'm using Dev C++ Ver. 4 ..I know that to fix a floating point number I
first have to include the header <iomanip>, which i have already done....
I dont know wat to do next..Pliz Help...
thanks.
--
---Deepesh Kapadia---
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javao
ne
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.9/1364 - Release Date: 07-Apr-08
6:38 PM
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
--
---Deepesh Kapadia---
------------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
------------------------------------------------------------------------------
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.9/1364 - Release Date: 07-Apr-08 6:38 PM
|