#include<iostream.h>
#include<conio.h>
class Saltax
{
 float x,t;
 public:
 Saltax()
 {
  t=x=0;
 }
 void get();
 void perform();
};
 void Saltax::get()
 {
  cout<<"Enter the salary:";
  cin>>x;
  return x;
 }
 void Saltax::perform()
 {
  if(x<=1000)
  t=0;
  else if(x>1000&&x<=2000)
  {
   t=x*5/100;
  }
  else if(x>2000&&x<=3000)
  {
   t=(x*4/100);
  }
  else
   t=(x*3/100);
return t;
 }
void main()
{
 clrscr();
 Saltax s;
 cout<<"Your salary is\t:"<<s.get()<<endl;
 cout<<"The tax apply on your salary is\t:"<<s.perform()<<endl;
 getch();
}

I not really familar with C++, but the error seems like you trying to return a value in void function, which is illegal.

Try replace the void with the return value datatype.

float Saltax::get() {
    cout << "Enter the salary:";
    cin>>x;
    return x;
}

Don't forget to change this

float get();

Also, I don't think void main() is allowed in C++. Shouldn't it be int main() ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.