Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2005

Tip: Looking for answers? Try searching our database.

Newb has output formatting question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
menotu3169 - 15 Nov 2005 02:30 GMT
Alright, I'm just learning C++ and I'm trying to make a program.
It uses a 10*10 array, calculates what all the values are and then
outputs the values stored in the array on the screen.

My teacher's out sick, and no one in my class has been able to help
me.

What I want to do, is take an array of double values, and output them
on the screen in a nice looking format.

All I really need is a way to output a different number of spaces,
depending on the number of decimal places in the number.

I've tried using strlen(), but that doesn't work, as it's an array of
numbers.

Any help would be greatly appreciated.
And can you try to keep answers simple, I am just learning this stuff.


Peter Oliphant - 15 Nov 2005 14:47 GMT
int Digits_in_Double( double value )
{
  return value.ToString()->Length ;
}

The number of digits includes decimal point and negative sign if negative.
It also assumes base 10 math... : )

[==P==]

int number_of_digits_in double =

> Alright, I'm just learning C++ and I'm trying to make a program.
> It uses a 10*10 array, calculates what all the values are and then
[quoted text clipped - 20 lines]
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.