Click here to Skip to main content
15,846,342 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
#include <iostream>
#include <iomanip>

using namespace std;

class payroll {


    string name;
    int day;
    int rate;
    int ot;
    int otrate;
    int sss;
    int phil;
    int pgibg;

    public :

      int get_info();
      void display_info();
 int payroll :: get_info()
     cout << "\t\tPayroll System";
     cout <<"\t\tFivelia Company";
     cout <<"\t\t833 C. Jose Ave. Quezon City ";
     cout << "\n\nEnter Employees Name     : ";
     cout << "Enter No. of Days Worked : ";
     cin >> day;
     cout << "Enter Daily Rate         : ";
     cin >> rate;
     cout << "Enter No. of hours overtime  : ";
     cin >> ot;
     cout << "Enter Overtime rate per hour        : ";
     cin >> otrate;
     cout<<"\t\tMONTHLY DEDUCTION";

     cout<<"\nSSS Monthly Contribution: "<<((rate*day)+(ot*otrate)*.045);
     cout<<"PhilHealth Monthly Contribution: "<<((rate*day)+(ot*otrate)*.035);
     cout<<"\nPAGIBIG Monthly Contribution: "<<((rate*day)+(ot*otrate)*.02);

="" void="" payroll="" ::display_info()
="" {

="" cout="" <<="" "\n\n";
="" "="=====================================";
" "\t\tpayroll";
="" <<"\t\tfivelia="" company";
="" <<"\t\t833="" c.="" jose="" ave.="" quezon="" city="" ";
="" "\n";
="" "\nemployees="" name="" :="" name;
="" cout<<"\ngross="" pay:="" "<<((rate*day)+(ot*otrate));
="" cout<<"\ntotal="" monthly="" deduction:="" php="" "<<sss+phil+pgibg;
="" cout<<"\nnet="" "<<((rate*day)+(ot*otrate)-(sss+pgibg+phil));
="" cout<<"\n\n="=============THANKYOU==============";
" }

="" int="" main()="" {
="" emp;
="" emp.get_info();
="" emp.display_info();

="" }

What I have tried:

I am confused.
Updated 2-Feb-22 4:03am

When your code won't compile, start by looking at the error message.
Pasting the legible part code into an online C++ compiler and trying to compile it, gives the first errors as:
main.cpp:56:9: error: no match for ‘operator<<’ (operand types are ‘std::istream’ {aka ‘std::basic_istream’} and ‘int’)
   56 |      cin<<pgibg;
      |      ~~~^~~~~~~
      |      |    |
      |      |    int
      |      std::istream {aka std::basic_istream<char>}
And there is a lot of information there:
That's the file name, and the line and column numbers where the error was detected.
So go there: most editors support CTRL + G to go directly to a line number.
It's this one:

error: no match for ‘operator<<’ (operand types are ‘std::istream’ {aka ‘std::basic_istream’} and ‘int’)
That's a description of what it found.
It's not that helpful in this case, ut it tells you something: there is no "operator<<" defined for an input stream and an integer.
56 |      cin<<pgibg;
      |      ~~~^~~~~~~
      |      |    |
      |      |    int
      |      std::istream {aka std::basic_istream<char>}
The rest just show you the line and points out the parts it didn't understand.

Now look at that line with a couple of lines for context:
cout<<"PhilHealth Monthly Contribution: "<<((rate*day)+(ot*otrate)*.035);
     cout<<"\nPAGIBIG Monthly Contribution: "<<((rate*day)+(ot*otrate)*.02);
Hmm ... shouldn't cin be directed into a variable, rather than a variable directed into cin?
Turn the less thans into greater thans, and the error should go away.
cin >> pgibg;

Recompile, then repeat that process of examination and cogitation for each error message, and you'll soon fix them all!
Share this answer
1298201 2-Feb-22 7:15am    
thank you so much
OriginalGriff 2-Feb-22 7:24am    
You're welcome!
k5054 2-Feb-22 11:04am    
5'd. What a great mini-tutorial on how to go about finding and fixing syntax errors!
_Asif_ 3-Feb-22 5:09am    
It seems

* you just copy the code from some website, incorrectly paste it
* press F5 (run).
* Got Compiliation Error
* You came on Codeproject, paste the code again and asking to solve the problem, without putting any efforts at all.

My Friend, this is not a freelancing website. You need to precisely tell us, what is the error and where you stuck and need our help.

Usually these kind of problems instantly resolve, if you have debugging skills. My advice would be to get a good article on How to debug application. This will solve this problem and increase your error resolution knowledge!.

Share this answer
1298201 2-Feb-22 6:30am    
Actually, these codes are mine. I just want to ask if what did I do wrong coz I can't run MY program. well thanks for your effort to type.
_Asif_ 2-Feb-22 6:37am    
Your code have garbages, forexample what is [="" void="" payroll="" ::display_info()]?
Richard MacCutchan 2-Feb-22 7:51am    
It's a bug in the CodeProject editor. When certain characters are paste they appear as ="".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900