y am i getting these errors
i tryed adding iostream as a headder file but i get 60 more error messages
1>c:\documents and settings\robert dobler\my documents\visual studio 2005\projects\pro3\source1.cpp(15) : error C2065: 'cout' : undeclared identifier
1>c:\documents and settings\robert dobler\my documents\visual studio 2005\projects\pro3\source1.cpp(16) : error C2065: 'cin' : undeclared identifier
1>c:\documents and settings\robert dobler\my documents\visual studio 2005\projects\pro3\source1.cpp(32) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
1>c:\documents and settings\robert dobler\my documents\visual studio 2005\projects\pro3\source1.cpp(36) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
1>c:\documents and settings\robert dobler\my documents\visual studio 2005\projects\pro3\source1.cpp(40) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
Code:
//Robert Dobler
#include <iomanip>
#include <string>
using namespace std;
int main ()
{
int yearsofservice,yearhired,oldsalary,code,newsalary,salaryincrease;
int numfaculty,totsalaryincrease,avgsalaryincrease;
const double ONE=.03;
const double TWO=.05;
const double THREE=.08;
const int YEAR=2007;
int facultycounter=1;
string facultyname;
cout<<"How many faculty members are you inputting?:";
cin>>numfaculty;
do
{
cout<<"Input the members name:";
getline(cin,facultyname);
cout<<"Input the members year hired:";
cin<<yearhired;
yearsofservice=yearhired-YEAR;
cout<<"Input the members old salary:";
cin>>oldsalary;
cout<<"Input the members code:";
cin>>code;
if (code==1)
{
newsalary=oldsalary*ONE;
}
else if (code==2)
{
newsalary=oldsalary*TWO;
}
else if (code==3)
{
newsalary=oldsalary*THREE;
}
salaryincrease=oldsalary-newsalary;
cout<<"Robert Dobler\n\n\n";
cout<<setw(15)<<"FAILNONE UNIVERSITY FACULTY SALARY REPORT FOR "<<YEAR;
cout<<setw(10)<<"FACULTY"<<endl<<"NAME"<<endl<<"-------";
cout<<setw(35)<<"YEARS OF"<<endl<<"SERVICE"<<endl<<endl<<"-------";
cout<<setw(45)<<"OLD SALARY"<<endl<<"---";
cout<<setw(55)<<"NEW SALARY"<<endl<<"------";
cout<<setw(65)<<"SALARY"<<endl<<"INCREASE"<<endl<<"-------";
cout<<setw(10)<<facultyname<<setw(35)<<yearsofservice<<setw(45)<<oldsalary;
cout<<setw(55)<<newsalary<<setw(65)<<salaryincrease;
}while (facultycounter++ <numfaculty);
return 0;
}
i still need help error C2001: newline in constant
i did add
Code:
#include'd <iostream>
but i still get the following error and warning messages
error C2001: newline in constant
error C2015: too many characters in constant
error C2006: '#include' : expected a filename, found 'constant'
fatal error C1083: Cannot open include file: '': No such file or directory
Code:
//Robert Dobler
#include <iomanip>
#include <string>
#include'd <iostream>
using namespace std;
int main ()
{
int yearsofservice,yearhired,oldsalary,code,newsalary,salaryincrease;
int numfaculty,totsalaryincrease,avgsalaryincrease;
const int YEAR=2007;
int facultycounter=1;
string facultyname;
cout<<"How many faculty members are you inputting?:";
cin>>numfaculty;
do
{
cout<<"Input the members name:";
getline(cin,facultyname);
cout<<"Input the members year hired:";
cin<<yearhired;
yearsofservice=yearhired-YEAR;
cout<<"Input the members old salary:";
cin>>oldsalary;
cout<<"Input the members code:";
cin>>code;
switch (code)
{
case 1: newsalary=oldsalary*.03;
case 2: newsalary=oldsalary*.05;
case 3: newsalary=oldsalary*.08;
break;
default: cout<<"You did not type any code in!!!";
}
salaryincrease=oldsalary-newsalary;
}while (facultycounter++ <numfaculty);
return 0;
}
can some one please tell me y i get these errors and how to fix them PLEASE!! does the program look ok otherwise?
its compiling and running
the program is now compiling and running im still having a problem listing multiple the output data im stuck and i don;t know what to do
Code:
#include <iomanip>
#include <string>
#include <iostream>
using namespace std;
int main ()
{
int yearsofservice,yearhired,oldsalary,code;
int numfaculty,totsalaryincrease,avgsalaryincrease;
int facultycounter=1;
double newsalary;
double salaryincrease;
const int YEAR=2007;
string fname;
string lname;
cout<<"How many faculty members are you inputting?:";
cin>>numfaculty;
do
{
cout<<"Input the members name:";
cin>>fname>>lname;
cout<<"Input the members year hired:";
cin>>yearhired;
cout<<"Input the members old salary:";
cin>>oldsalary;
cout<<"Input the members code:";
cin>>code;
switch (code)
{
case 1: salaryincrease=oldsalary*(.03);
break;
case 2: salaryincrease=oldsalary*(.05);
break;
case 3: salaryincrease=oldsalary*(.08);
break;
default: cout<<"You did not type any code in!!!";
}
newsalary=salaryincrease+oldsalary;
yearsofservice=YEAR-yearhired;
}while (facultycounter++ <numfaculty);
cout<<"Robert Dobler\n\n\n";
cout<<setw(57)<<"FAILNONE UNIVERSITY FACULTY SALARY REPORT FOR "<<YEAR<<endl<<endl<<endl<<endl;
cout<<setw(10)<<"FACULTY"<<setw(17)<<"YEARS OF"<<setw(11)<<"OLD"<<setw(11)<<"NEW"<<setw(17)<<"SALARY"<<endl;
cout<<setw(8)<<"NAME"<<setw(19)<<"SERVICE"<<setw(13)<<"SALARY"<<setw(11)<<"SALARY"<<setw(16)<<"INCREASE"<<endl;
cout<<setw(10)<<"-------"<<setw(17)<<"--------"<<setw(13)<<"------"<<setw(11)<<"------"<<setw(16)<<"--------"<<endl;
cout<<fname<<lname<<setw(12)<<yearsofservice<<setw(16)<<oldsalary<<setw(11)<<newsalary<<setw(14)<<salaryincrease<<endl;
return 0;
}
i have to list several outputs st once and it only lets me list the newest inputs i enter in
THIs is a picture of how it is soposed to be outputted