Display output in table format.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abrown07
    New Member
    • Jan 2010
    • 27

    Display output in table format.

    How would I be able to neaten up my output by putting them in a table with the following headers:
    Stellar Body, Escape Velocity, Gravity Factor.
    I can get the outputs fine but I have them in coming out just continuously rather than in table format and I would like to tidy the program up.
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    Print the headings with one or two tabs (\t) in between each.
    Do likewise with the data output
    e.g
    cout<<"\tStella r Body"<<"\t\t"<< "Escape Velocity"<<"\t\ t"<<Gravity Factor";
    cout<<"\tEarth" <<"\t\t"<<11.17 km/sec<<"\t\t"<<5. 17439E27;

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      Or separate each field with a comma, making your output file compliant with the comma-separated-values file format. Then you can import that file into Microsoft Excel and make the final output as pretty as you like.

      Comment

      Working...