News
Forums
Search
Members
Sign Up
My Code Newbie
Username
Password
Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET
C.N. Friends
Planet Rome
Link to Us!
Code Newbie
Code Forums
>
Application and Web Development
>
Standard C, C++
a way to set decimal points limit?
User Name
Remember Me?
Password
Register
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
LinkBack
Thread Tools
Display Modes
10-24-2004, 11:29 AM
#
1
(
permalink
)
cracksevi
Registered User
Join Date: Oct 2004
Posts: 14
a way to set decimal points limit?
for example if decimal point is limited to 2 , it must show the number like 3476.88 or 42354387.15
hope u got what i meant...
cuz set precision limits the whole number...not only floating part
(sorry for bad english)
cracksevi
View Public Profile
Find More Posts by cracksevi
10-24-2004, 12:16 PM
#
2
(
permalink
)
Valmont
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
What do you mean it limits the whole number?
How is the number in the code below limited by setprecision then?
Code:
double
f; f=4456789123.123456; cout.setf(ios::fixed); cout << setprecision(2) << f << endl;
__________________
Valmont
View Public Profile
Find More Posts by Valmont
10-24-2004, 07:41 PM
#
3
(
permalink
)
Kernel_Killer
Regular Contributor
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Is there not a scale function of some sort, or is that how you do it? "setprecision(scale)" ?
Just curious.
__________________
Network Synapse
Screaming Electron
Kernel_Killer
View Public Profile
Visit Kernel_Killer's homepage!
Find More Posts by Kernel_Killer
10-25-2004, 10:01 AM
#
4
(
permalink
)
cracksevi
Registered User
Join Date: Oct 2004
Posts: 14
i mean...
if for example the result is 34235.45346 it must be shown as if i set the limit as 2 : 4235.45
cracksevi
View Public Profile
Find More Posts by cracksevi
10-25-2004, 11:12 AM
#
5
(
permalink
)
Valmont
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
The code above does just that.
__________________
Valmont
View Public Profile
Find More Posts by Valmont
10-25-2004, 01:44 PM
#
6
(
permalink
)
cracksevi
Registered User
Join Date: Oct 2004
Posts: 14
hmm....then i need ios:fixed too for it...
cuz i tried only setprecision as i remember..
and it was giving me results like 4e + 001 or sth..
cracksevi
View Public Profile
Find More Posts by cracksevi
Bookmarks
Digg
del.icio.us
StumbleUpon
Google
«
Previous Thread
|
Next Thread
»
Thread Tools
Show Printable Version
Email this Page
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
BB code
is
On
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Hacking your Linksys WRT54G
sde
Linux / BSD / OS X
18
04-20-2005
03:37 PM
OpenGL.dll
Mr.Anderson
Platform/API C++
3
08-13-2004
10:07 AM
what language is this?
sde
All Other Coding Languages
10
05-25-2004
03:57 PM
All times are GMT -8. The time now is
05:08 PM
.
Contact Us
-
CodeNewbie.com
-
Archive
-
Top
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by
vBSEO
3.0.0 RC8
Copyright © 2000-2008,
Milano Interactive
Web Hosting provided by
Portal 360 Web Hosting
LinkBack
LinkBack URL
About LinkBacks