error messages i need help please!

This is a discussion on error messages i need help please! within the C++ Programming forums, part of the General Programming Boards category; i get these errors please help!!! Code: 1>c:\documents and settings\robert dobler\my documents\visual studio 2005\projects\pro3\source1.cpp(15) : error C2065: 'cout' : undeclared ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    12

    error messages i need help please!

    i get these errors please help!!!
    Code:
    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
    
     
    
    #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;
    
    }

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    you need to include the iostream header file.
    You're only born perfect.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,762
    Same question asked in another thread, but with better formatting - closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21