I am trying to write a program that has a .txt file. It includes 4 names, 4 pay rates and the hours they worked. I have to use the file and import the data and make a program that outputs each worker their pay rate, hours they worked and their pay for the time they worked. I do not understand how to use the information from the .txt file. How can I make a program where it outputs this.

I was trying to get it to look like this:

===Pay Report===
Employee:
Callaway, G
Pay rate: 6.00
Hours Worked: 40
Pay Amount: 240.00

Thanks for the help.

Have you written anything so far, if yes may I see?

What you need to do is parse the text file. If you can expect the file to always have that structure it should be an easy task. Using ifstream and ofstream you'd:
- Skip the first to lines
- Read in the name
- Skip two words and then read the pay rate into a float/double
- etc.

But I'm not sure if I understood the question correctly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.