instream,outstream trouble, don't know how to multiply different wages by different amounts.

My code is outputting some long negative number (error number I guess) and I don't know why. I looked at my code and the examples in my book and I can't find why it's doing this.
I placed the file that I want read in C:\Users\jackelinblack\Documents\Visual Studio 2010\Projects\Lab 12\Lab 12 [solved] hint given by ats15.

I have unaccounted problem, I don't know how to get it to output a list of names. I was going to write a do-while loop but i don't know how to end it.[solved-used for loop] figured it out.

I have another problem. I have three people and each of them have a different raise, how do I give each person their proper raise?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
	ifstream lab_in;
	ofstream lab_out;

	lab_in.open("lab_12_ex.01data.txt");
	if(lab_in.fail())
	{
		cout<<"Input has failed"<<endl;
		exit(1);
	}
	lab_out.open("lab_12_ex.01output.txt");
	if(lab_out.fail())
	{
		cout<<"output fail"<<endl;
		exit(1);
	}
	cout<<fixed<<showpoint<<setprecision(2); //not working
       
        for(int i=0;i<=4;i++)
{
        string lname, fname;
	double salary;// nsalary;

	lab_in>>lname>>fname>>salary;
	lab_out<<"the employees name is "<<lname<<","<<fname<<" and their salary is "<<salary<<endl;
	i++;
}
	lab_in.close();
	lab_out.close();
	system("pause");
		return 0;
}
Last edited on
Why is name an int?
thanks completely missed that.
Last edited on
Topic archived. No new replies allowed.