class problem not displaying anything

I've created my class and tried to get it to display anything but it gets me 2 errors which are; 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup , 2 error LNK1120: 1 unresolved externals. I'm not sure if I forgot something or did this wrong?


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
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>

using namespace std;

class Employee
{
private:
	string firstName;
	string lastName;
	char gender;
	int dependents;
	double annualSalary;

public:
	Employee();
	Employee(string, string, char, int, double);
	double calculatePay(double);
	void DisplayEmployee();
	string getfirstName(string);
	void setfirstName();
	string getlastName(string);
	void setlastName();
	char getgender(char);
	void setgender();
	int getdependents(int);
	void setdependents();
	double getannualSalary(double);
	void setannualSalary();
};

Employee::Employee()
{
	firstName ="not given";
	lastName ="not given";
	gender= 'U';
	dependents= 0;
	annualSalary = 20000;
};

Employee::Employee(string firstName, string lastName, char gender, int dependents, double annualSalary)
{
	firstName = firstName;
	lastName = lastName;
	gender = gender;
	dependents = dependents;
	annualSalary = annualSalary;
};

double Employee::calculatePay(double)
{ 
	return annualSalary / 52;
};

void Employee::DisplayEmployee()
{ 
	cout <<"Employee Information "<< endl;
	cout << "Employee First Name: " << endl;
	cin >> firstName;
	cout << "Enter Last Name: " << endl;
	cin >> lastName;
	cout << "Employee Gender: " << endl;
	cin >> gender;
	cout << "Employee Dependents: " << endl;
	cin >> dependents;
	cout << "Employee Annual Salary:\t" << annualSalary << setprecision(2) << showpoint << fixed << annualSalary << "\n";
};
did you include the class header in your main.cpp ?
no, I just started learning about classes so I really don't know what does it need. I just went straight off on how the lab was described which really didn't explain a lot.
Last edited on
then how did you plan to use this?
post what you have in your main too
I was trying to get it to display the first and last name, with the gender, followed by the dependents, and then to enter the annual salary to finally get the weekly salary. I guess it didn't work much.
Topic archived. No new replies allowed.