Code Newbie
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 Newbie
    forums
Old 10-24-2004, 11:29 AM   #1 (permalink)
cracksevi
Registered User
 
Join Date: Oct 2004
Posts: 14
cracksevi is on a distinguished road
Send a message via ICQ to cracksevi
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 is offline   Reply With Quote
Old 10-24-2004, 12:16 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
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 is offline   Reply With Quote
Old 10-24-2004, 07:41 PM   #3 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
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 is offline   Reply With Quote
Old 10-25-2004, 10:01 AM   #4 (permalink)
cracksevi
Registered User
 
Join Date: Oct 2004
Posts: 14
cracksevi is on a distinguished road
Send a message via ICQ to cracksevi
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 is offline   Reply With Quote
Old 10-25-2004, 11:12 AM   #5 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
The code above does just that.
__________________
Valmont is offline   Reply With Quote
Old 10-25-2004, 01:44 PM   #6 (permalink)
cracksevi
Registered User
 
Join Date: Oct 2004
Posts: 14
cracksevi is on a distinguished road
Send a message via ICQ to cracksevi
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 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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.


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