5 Replies - 492 Views - Last Post: 03 April 2009 - 07:26 PM Rate Topic: -----

#1 Joseph135  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 20-February 09

Please, I need help displaying information in chart

Posted 03 April 2009 - 04:08 PM

So I have a 5x5 chart I need to display the information in. I am given a file called payroll.txt and I have opened it by doing infile.open("payroll.txt"). What do I have to do now to get the information to display??? Also, I have already typed out all of Titles that I have named each column, So I need the information to be displayed with my titles from the columns. If anymore information is helpful I will try and supply it. Thanks.

This post has been edited by Joseph135: 03 April 2009 - 04:30 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Please, I need help displaying information in chart

#2 Notorion  Icon User is offline

  • D.I.C Regular

Reputation: 35
  • View blog
  • Posts: 378
  • Joined: 17-February 09

Re: Please, I need help displaying information in chart

Posted 03 April 2009 - 05:08 PM

try using setw(), or width()

you can google them "setw() c++"

They are in the file
#include <iomanip>


Was This Post Helpful? 0
  • +
  • -

#3 Joseph135  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 20-February 09

Re: Please, I need help displaying information in chart

Posted 03 April 2009 - 05:13 PM

I know how to do that, but what I am trying to do is have the information displayed. Don't I need to do something like infile>>payroll.txt?? or something like infile>>hours>>Employee or whatever information is in the file?
Was This Post Helpful? 0
  • +
  • -

#4 Notorion  Icon User is offline

  • D.I.C Regular

Reputation: 35
  • View blog
  • Posts: 378
  • Joined: 17-February 09

Re: Please, I need help displaying information in chart

Posted 03 April 2009 - 05:21 PM

Please post the input file, but so far it seems that what you have mentioned, for what you appear to be asking is correct.

infile>>hours>>Employee;


Was This Post Helpful? 0
  • +
  • -

#5 Joseph135  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 20-February 09

Re: Please, I need help displaying information in chart

Posted 03 April 2009 - 05:38 PM

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
ifstream infile;
double ch=0.00;
infile.open("payroll.txt");

void instructions();

void reportTitle();

int main()
{
instructions();

reportTitle();

return 0;
}

void instructions()
{
cout<<This information displays payroll information.";
}

void reportTitle()
{
cout<<setprecision(2)<<fixed<<showpoint<<left;

cout<<setw(20)<<"Employee"<<setw(10)<<"Hourly"
<<setw(10)<<"Hours"<<setw(10)<<"Tax"<<setw(10)
<<"Gross"<<setw(10)<<"Net"<<endl;

cout<<setw(20)<<"Name"<<setw(10)<<"Rate"
<<setw(10)<<"Worked"<<setw(10)<<"Rate"<<setw(10)
<<"Amount"<<setw(10)<<"Amount"<<endl;
}
infile>>ch;
infile.close().


Was This Post Helpful? 0
  • +
  • -

#6 Joseph135  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 20-February 09

Re: Please, I need help displaying information in chart

Posted 03 April 2009 - 07:26 PM

Does anybody know what I would have to do in order to display the information???
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1