error code c1083

can someone tell me what to use instead of include stdafx.h, when l build it gives me error c1083 saying cant open file directory. pls check it for me


#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <iomanip>
#include <string>
using namespace std;
class Employee
{
string name;
int employeetype;
string vacationdaysused;
string sickdaysused;
public:
Employee()
{
name=" ";
employeetype=0;
vacationdaysused=" ";
sickdaysused=" ";
}
void settype(string TYPE )
{
TYPE=type;
}
void setemployeetype (int type){TYPE =employeetype;}
{
TYPE=employeetype;
}
void setvacationdayused (string VACATION)
{
VACATION=vacation;
}
void setsickdaysused(string SICKDAYS)
{
SICKDAYS=sickdaysused;
}
string gettype()
{
return (type);
}
int getemployeetype()
{
return(employeetype);
}
string getvacationdaysused()
{
return(vacationdays);
}
string getsickdays()
{
return (sickdays);
}
void show_record();
};
void Employee::show_record()
{
cout << "Employeetype " << getemployeetype()<<endl;
cout << "EMPLOYEE " << getemployeetype()<<endl;
cout << "Vacation" << getvacationdayused()<<endl;
cout << "Sick" << getsickdaysused()<<endl;
}
int main()
{
const int SIZE=3;
Employee employee[SIZE];
string EMPLOYEE;
int TYPE;
string ;VACATION
string SICK;
for (int i=0; i<SIZE;i++)
{
cout << "Enter the Employee type : " << endl;
cin>>TYPE;
employee[i].settype(TYPE);
cout << "Enter the Employees type: " << endl;
cin >> TYPE;
employee[i].setemployeetype(type);
cout << "Enter the Employees Vacation days used: " << endl;
cin>>VACATION;
employee[i].setvacationdays(VACATION);
cout << "Enter the Employees SICK: " << endl;
cin>>SICK;
employee[i].setsickdays(SICK);
}
for (int i=0;i<SIZE;i++)
employee[i].show_record();
system ("pause");
return 0;
}
Put your code in the code tags,
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

#include "stdafx.h"
 #include <iostream>
 #include <cstring>
 #include <iomanip>
 #include <string>
 using namespace std;
 class Employee
 {
 string name;
 int employeetype;
 string vacationdaysused;
 string sickdaysused;
 public:
 Employee()
 {
 name=" ";
 employeetype=0;
 vacationdaysused=" ";
 sickdaysused=" ";
 }
 void settype(string TYPE )
 {
 TYPE=type;
 }
 void setemployeetype (int type){TYPE =employeetype;}
 {
 TYPE=employeetype;
 }
 void setvacationdayused (string VACATION)
 {
 VACATION=vacation;
 }
 void setsickdaysused(string SICKDAYS)
 {
 SICKDAYS=sickdaysused;
 }
 string gettype()
 {
 return (type);
 }
 int getemployeetype()
 {
 return(employeetype);
 }
 string getvacationdaysused()
 {
 return(vacationdays);
 }
 string getsickdays()
 {
 return (sickdays);
 }
 void show_record();
 };
 void Employee::show_record()
 {
 cout << "Employeetype " << getemployeetype()<<endl;
 cout << "EMPLOYEE " << getemployeetype()<<endl;
 cout << "Vacation" << getvacationdayused()<<endl;
 cout << "Sick" << getsickdaysused()<<endl;
 }
 int main()
 {
 const int SIZE=3;
 Employee employee[SIZE];
 string EMPLOYEE;
 int TYPE;
 string ;VACATION
 string SICK;
 for (int i=0; i<SIZE;i++)
 {
 cout << "Enter the Employee type : " << endl;
 cin>>TYPE;
 employee[i].settype(TYPE);
 cout << "Enter the Employees type: " << endl;
 cin >> TYPE;
 employee[i].setemployeetype(type);
 cout << "Enter the Employees Vacation days used: " << endl;
 cin>>VACATION;
 employee[i].setvacationdays(VACATION);
 cout << "Enter the Employees SICK: " << endl;
 cin>>SICK;
 employee[i].setsickdays(SICK);
 }
 for (int i=0;i<SIZE;i++)
 employee[i].show_record();
 system ("pause");
 return 0;
 } 
if you are not using VS on Windows then try commenting that line. stdafx is VS specific header.
l am using window visual 2008, and please i don't understand when you said l should put my code in the code tags.
your response would be appreciated

thanks
Try removing the stdafx anyway and see if it works(otherwise post back then the solution will be somewhat complex)

Post code encased in code tags as Pickle Gunner has done for you.
Use the "<>" symbol on the format menu
thanks l did both, it did not build, still saying same error
You have a number of problems in your code:
1) Lines 24, 28, 32, 26. In each of you setter functions, you have the left and right side of the assignment statement reversed.
2) Line 26. You have the body of the function twice.
3) Line 40. type is not a member of the class.
4) Are type and employeetype the same or different. If the same, you have two different setter functions for the same variable. If the different, then type is not defined.
5) Line 48. vacationsdays does not match the declaration. Should be vacationdaysused.
6) Line 69. Extraneous semicolon after string.
7) Line 60: getvacationdayused() is misspelled.
8) Line 61: Again fuction call does not match declaration in class.
9) Line 68: type is declared as int. You're trying to pass it to a function taking a string.
10) Line 78: same issue.
11) Line 81: Function call does not match declaration in class.
12) Line 84: Same issue.

BTW, I had no problem ccompiling without stdafx.h





Last edited on
//employee.cpp
#include <iostream>
#include <cstring>
#include <iomanip>
#include <string>
using namespace std;

class Employee
{
string name;
int employeetype;
string vacationdaysused;
string sickdaysused;
public:
Employee()
{
name=" ";
employeetype=0;
vacationdaysused=" ";
sickdaysused=" ";
}
void settype(string TYPE )
{
TYPE=type;
}
void setemployeetype;
{
TYPE=employeetype;
}
void setvacationdayused (string VACATION)
{
VACATION=vacation;
}
void setsickdaysused(string SICKDAYS)
{
SICKDAYS=sickdaysused;
}
string gettype()

}
int getemployeetype()
{
return(employeetype);
}
string getvacationdaysused()
{
return(vacationdaysused);
}
string getsickdays()
{
return (sickdays);
}
void show_record();
};
void Employee::show_record()
{
cout << "Employeetype " << getemployeetype()<<endl;
cout << "EMPLOYEE " << getemployeetype()<<endl;
cout << "Vacation" << getvacationdayused()<<endl;

}
int main()
{
const int SIZE=3;
Employee employee[SIZE];
string EMPLOYEE;
TYPE;
string VACATION
string SICK;
for (int i=0; i<SIZE;i++)
{
cout << "Enter the Employee type : " << endl;
cin>>TYPE;
employee[i].settype(TYPE);
cout << "Enter the Employees type: " << endl;
cin >> TYPE;
setemployeetype(type);
cout << "Enter the Employees Vacation days used: " << endl;
cin>>VACATION;
cout << "Enter the Employees SICK: " << endl;
cin>>SICK;
}
for (int i=0;i<SIZE;i++)
employee[i].show_record();
system ("pause");

return 0;
}



i did what you said but can not build with and without the stdafx.h, now its giving me 25errors. thanks for reply. pls can you help me further
You've not fixed the things I pointed out and I won't be helping further until you edit your post and bracket your code with CODE TAGS.

Either insert
[code]
before the first line of code and insert
[/code]
after the last line of code; or highlight the first through last line of code and click the <> formatting button.
#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <iomanip>
#include <string>
using namespace std;
class Employee
{
string name;
int employeetype;
string vacationdaysused;
string sickdaysused;
public:
Employee()
{
name=" ";
employeetype=0;
vacationdaysused=" ";
sickdaysused=" ";
}
void settype(string TYPE )
{
TYPE=type;
}
void setemployeetype (int type){TYPE =employeetype;}
{
TYPE=employeetype;
}
void setvacationdayused (string VACATION)
{
VACATION=vacation;
}
void setsickdaysused(string SICKDAYS)
{
SICKDAYS=sickdaysused;
}
string gettype()
{
return (type);
}
int getemployeetype()
{
return(employeetype);
}
string getvacationdaysused()
{
return(vacationdays);
}
string getsickdays()
{
return (sickdays);
}
void show_record();
};
void Employee::show_record()
{
cout << "Employeetype " << getemployeetype()<<endl;
cout << "EMPLOYEE " << getemployeetype()<<endl;
cout << "Vacation" << getvacationdayused()<<endl;
cout << "Sick" << getsickdaysused()<<endl;
}
int main()
{
const int SIZE=3;
Employee employee[SIZE];
string EMPLOYEE;
int TYPE;
string ;VACATION
string SICK;
for (int i=0; i<SIZE;i++)
{
cout << "Enter the Employee type : " << endl;
cin>>TYPE;
employee[i].settype(TYPE);
cout << "Enter the Employees type: " << endl;
cin >> TYPE;
employee[i].setemployeetype(type);
cout << "Enter the Employees Vacation days used: " << endl;
cin>>VACATION;
employee[i].setvacationdays(VACATION);
cout << "Enter the Employees SICK: " << endl;
cin>>SICK;
employee[i].setsickdays(SICK);
}
for (int i=0;i<SIZE;i++)
employee[i].show_record();
system ("pause");
return 0;
}


Pls dont be annoyed with me, l just going nut, was trying to figure out what is insert code as lm here for only a week now still new pls. l did what you asked hope l did the right thing. just came back from class and saw it.
#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <iomanip>
#include <string>
using namespace std;
class Employee
{
string name;
int employeetype;
string vacationdaysused;
string sickdaysused;
public:
Employee()
{
name=" ";
employeetype=0;
vacationdaysused=" ";
sickdaysused=" ";
}
void settype(string TYPE )
{
TYPE=type;
}
void setemployeetype (int type){TYPE =employeetype;}
{
TYPE=employeetype;
}
void setvacationdayused (string VACATION)
{
VACATION=vacation;
}
void setsickdaysused(string SICKDAYS)
{
SICKDAYS=sickdaysused;
}
string gettype()
{
return (type);
}
int getemployeetype()
{
return(employeetype);
}
string getvacationdaysused()
{
return(vacationdays);
}
string getsickdays()
{
return (sickdays);
}
void show_record();
};
void Employee::show_record()
{
cout << "Employeetype " << getemployeetype()<<endl;
cout << "EMPLOYEE " << getemployeetype()<<endl;
cout << "Vacation" << getvacationdayused()<<endl;
cout << "Sick" << getsickdaysused()<<endl;
}
int main()
{
const int SIZE=3;
Employee employee[SIZE];
string EMPLOYEE;
int TYPE;
string ;VACATION
string SICK;
for (int i=0; i<SIZE;i++)
{
cout << "Enter the Employee type : " << endl;
cin>>TYPE;
employee[i].settype(TYPE);
cout << "Enter the Employees type: " << endl;
cin >> TYPE;
employee[i].setemployeetype(type);
cout << "Enter the Employees Vacation days used: " << endl;
cin>>VACATION;
employee[i].setvacationdays(VACATION);
cout << "Enter the Employees SICK: " << endl;
cin>>SICK;
employee[i].setsickdays(SICK);
}
for (int i=0;i<SIZE;i++)
employee[i].show_record();
system ("pause");
return 0;
}
What part of insert
[code]

before the first line of code and insert
[/code]

after the last line of code don't you understand?
#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <iomanip>
#include <string>
using namespace std;
class Employee
{
string name;
int employeetype;
string vacationdaysused;
string sickdaysused;
public:
Employee()
{
name=" ";
employeetype=0;
vacationdaysused=" ";
sickdaysused=" ";
}
void settype(string TYPE )
{
TYPE=type;
}
void setemployeetype (int type){TYPE =employeetype;}
{
TYPE=employeetype;
}
void setvacationdayused (string VACATION)
{
VACATION=vacation;
}
void setsickdaysused(string SICKDAYS)
{
SICKDAYS=sickdaysused;
}
string gettype()
{
return (type);
}
int getemployeetype()
{
return(employeetype);
}
string getvacationdaysused()
{
return(vacationdays);
}
string getsickdays()
{
return (sickdays);
}
void show_record();
};
void Employee::show_record()
{
cout << "Employeetype " << getemployeetype()<<endl;
cout << "EMPLOYEE " << getemployeetype()<<endl;
cout << "Vacation" << getvacationdayused()<<endl;
cout << "Sick" << getsickdaysused()<<endl;
}
int main()
{
const int SIZE=3;
Employee employee[SIZE];
string EMPLOYEE;
int TYPE;
string ;VACATION
string SICK;
for (int i=0; i<SIZE;i++)
{
cout << "Enter the Employee type : " << endl;
cin>>TYPE;
employee[i].settype(TYPE);
cout << "Enter the Employees type: " << endl;
cin >> TYPE;
employee[i].setemployeetype(type);
cout << "Enter the Employees Vacation days used: " << endl;
cin>>VACATION;
employee[i].setvacationdays(VACATION);
cout << "Enter the Employees SICK: " << endl;
cin>>SICK;
employee[i].setsickdays(SICK);
}
for (int i=0;i<SIZE;i++)
employee[i].show_record();
system ("pause");
return 0;
}
Topic archived. No new replies allowed.