I cant figure out this error involing my char variable
Nov 6, 2011 at 8:38pm UTC
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
#include <iostream>
#include<string>
#include<stdlib.h>
#include<cstdlib>
#include<iomanip>
using namespace std;
class employee
{
private :
string fname;
string lname;
string input;
char gender;
int depend;
double ansal;
public :
employee();
employee(string, string, char , int , double );
double calculatePay(double );
void displayemployee();
string getfname(string);
void setfname();
string getlname(string);
void setlname();
char getgender(char );
void setgender();
int getdepend(int );
void setdepend();
double getansal(double );
void setansal();
void DisplayApplicationInformation();
void DisplayDivider(string message);
void TerminateApplication();
void DisplayEmployee();
string GetInput(string message);
};
employee::employee()
{
fname ="unkown" ;
lname ="unkown" ;
gender= "U" ;
depend= 0;
ansal = 20000;
};
employee::employee(string firstname, string lastname, char genderr, int depends, double annsal)
{
fname = firstname;
lname = lastname;
gender =genderr;
depend =depends;
ansal =annsal;
};
void employee::DisplayApplicationInformation()
{
cout<<"Welcome to your first Object Oriented Program--Employee Class"
<<"CIS247C, Week 2 Lab"
<<"Name: Jeremy Zavala" ;
};
void employee::DisplayDivider(string message)
{cout<<"\n*************** " + message + " *********************\n" ;
};
void employee::DisplayEmployee()
{
cout <<"======================Employee Information========================" << endl;
cout << "Employee Name:\t" << fname << " " <<lname <<endl;
cout << "Employee Gender:\t" << gender << endl;
cout << "Employee Dependents:\t" << depend << endl;
cout << "Employee Annual Salary:\t" << ansal <<
setprecision(2)<<showpoint<<fixed<<ansal<< "\n" ;
};
string employee::GetInput( string message)
{ string mystring;
cout<<"Please enter your " <<message<<":" ;
getline(cin, mystring);
return mystring;
};
void employee::TerminateApplication()
{ cout<<"\nThe end of the CIS247C Week2 iLab.\n" ;
};
double employee::calculatePay(double )
{
return ansal/52;
};
int main ()
{
employee TerminateApplication();
return 0;
}
On line 47 it says the = sign is the problem. I have never seen this problem before since i havent worked with char that much before. I am new to my object oriented class and need some help
Nov 6, 2011 at 9:02pm UTC
Use single quotes instead of double quotes for character literals.
Nov 6, 2011 at 9:11pm UTC
lol for reals....well i learned something today XD
Thanks so much
Last edited on Nov 6, 2011 at 9:13pm UTC
Topic archived. No new replies allowed.