![]() |
|
#1
|
|||
|
|||
Output into ColumnsI'm trying to output the results of a program I've written into a table-like format. At the moment Im using the setw(x) function to print a series of numbers to columns but they are not lining up because a space is narrower than a digit. I'm wondering if anyone knows of a way around this to try neaten things up?
Any help would be greatly appreciated. Here's the relevent code: CPP / C++ / C Code:
It probably makes little sense out of context. To try clear this up StructureMembers[i].getL() returns the length of a steel bar Net_X.getElement(i, j) returns a value in either decimal form or scientific notation. The corresponding output to this is: Distance from Start of Element: 0.000 0.625 1.25 1.88 2.50 Transverse Deflection: -2.14e+005 -2.14e+005 -2.14e+005 -2.14e+005 -2.14e+005 (m) Unfortionatly you can't see how this doesn't line up but you can understand the range of numbers I have. |
|||
|
#2
|
|||
|
|||
Re: Output into ColumnsQuote:
Quote:
Quote:
|
|
#3
|
|||
|
|||
Re: Output into ColumnsI'm attaching a screenshot of the output which is a .txt file. Hope this is clearer....
|
|
#4
|
|||
|
|||
Re: Output into ColumnsQuote:
|
|
#5
|
|||
|
|||
Re: Output into ColumnsThe issue is whatever program you're opening the .txt file in is not using monospace font. If you looked at the output on the console, it most likely would line up. Pick a monospace font, it'll probably look like what you want.
|
|
#6
|
|||
|
|||
Re: Output into ColumnsQuote:
Using the montype text fixes the problem, thanks. |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| run script command on ns2.26 | newbie06 | Computer Software Forum - Linux | 65 | 19-Aug-2009 08:50 |
| Bit stuffing | agnostos | C Programming Language | 17 | 12-Sep-2006 21:10 |
| need help with a console menu system | BullBuchanan | C++ Forum | 6 | 20-Aug-2006 15:46 |
| Formatting output into columns | Extro | C Programming Language | 5 | 24-Jun-2005 14:30 |
| No output from loop function | crystalattice | C++ Forum | 2 | 20-Dec-2004 21:39 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The