whats wrong with this code: employees salary recording

#include <iostream>
using namespace std;
const int MAX =100;
class Details
{
private:
int salary;
float roll;
public:
void getname( )
{
cout << "\n Enter the Salary:";
cin >> salary;
cout << "\n Enter the roll:";
cin >> roll;
}
void putname( )
{
cout << "Employees" << salary <<
"and roll is" << roll << '\n';
}
};
int main(void)
{
{
Details det[MAX];
int n=0;
char ans;
do{
cout << "Enter the Employee Number::" << n+1;
det[n++].getname;
cout << "Enter another (y/n)?: " ;
cin >> ans;
} while ( ans != 'n' );
for (int j=0; j<n; j++)
{
cout << "\nEmployee Number is:: " << j+1;
det[j].putname( );

}
return 0;
}
Last edited on
its an employee salary record but line 7 inside main is giving me error:
det[n++].getname;
[Error] statement cannot resolve address of overloaded function
you need parenthesis to call a function, even if it does not take any parameter
det[n++].gename();
thanks it works perfectly
Topic archived. No new replies allowed.