#include%26lt;iostream.h%26gt;
class player
{
public:
void getstats(void);
void showstats(void);
private:
char name[40];
int age;
int runs;
int tests;
float average;
float calcaverage(void);
};
void main()
{
player sachin;
sachin.getstats();
sachin.showstats();
player *dravid;
dravid=new player;
dravid-%26gt;getstats();
dravid-%26gt;showstats();
}
I am getting 2 errors in this class c++ pgm?why?plz..help me.?
getstats and showstats are declared but not defined. (There is no function body, just the prototype.)
Reply:pls define the functions:
void getstats()
{
}
void showstats()
{
}
and
define third function
float calcaverage()
{
return value;
}
Reply:you have not got any datas from the user.
and then if it is a programer's data it should be declared somewhere . but you havent done that also.
check your procedure properly once. may be ur program shall work//
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment