#include<iostream>
#include<string>
#define MAXnominees 3
using namespace std;

class MemberData
{
protected:
    int     ID ;
    char    Name[20];
    char    Add[20] ;
    char    Tel[15] ;
public:
	void enterData();
	void showData(void);
};

void MemberData::enterData() //allow user enter member's particular
{
	cout << "Please enter your Membership number: " << endl;
	cin >>ID;
	cout << "Please enter your Name: "<< endl;
	cin >>Name;
	cout << "Please enter your Address: " << endl;
	cin >>Add;
	cout << "Please enter your Handphone number: " << endl;
	cin >>Tel;
}
void MemberData::showData(void) //show member's particular
{
	cout << "Member ID is: "<< ID<<endl;
	cout << "Member Name is: "<<Name<<endl;
	cout << "Member's Add is: "<<Add<<endl;
	cout << "Member's Tel is: "<<Tel<<endl;
}
class  NomineeData : public MemberData  //Derived from class MemberData allow the user enter
	                                   //the nominees' particular
{
private:
	int N_ID[20];
	char N_Name[20];
public:
	void N_enterData(int, char);
	void N_showData(int, char);
};
void NomineeData::N_enterData(int N_ID, char N_Name)
{
	cout << "Please enter Nominee's ID: "<< endl;
	cin >> N_ID;
	cout << "Please enter Nominee's Name: "<< endl;
	cin >> N_Name;
}
void NomineeData::N_showData(int, char)
{
	cout << "Nominee's ID is: "<< N_ID << endl;
	cout << "Nominee's Name is: "<< N_Name << endl;
}
class Set_Nnum : public NomineeData  //Derived from class MemberData to assign no to nominees
{
private:
	char "James Tan", "Benny Koh", "Steven Lim", "David Tay", "Mary Tan";
public:
	void Setname(void);
};
void Set_Nnum::Setname(void)
{
	"James Tan" = 1;
	"Benny Koh" = 2;
	"Steven Lim" = 3;
	"David Tay" = 4;
	"Mary Tan" = 5;
}
int main()
{
	MemberData showdata;
	NomineeData N_showdata;

	showdata.enterData;
    showdata.showData();
	N_showdata.N_enterData();
	N_showdata.N_showData();
}

Recommended Answers

All 6 Replies

So what are the errors that you have ?

i think i repost my programme with errors stated:
01 #include<iostream>

02 #include<string>

03 #define MAXnominees 3

04 using namespace std;

05

06 class MemberData

07 {

08 protected:

09 int ID ;

10 char Name[20];

11 char Add[20] ;

12 char Tel[15] ;

13 public:

14 void enterData();

15 void showData(void);

16 };

17

18 void MemberData::enterData() //allow user enter member's particular

19 {

20 cout << "Please enter your Membership number: " << endl;

21 cin >>ID;

22 cout << "Please enter your Name: "<< endl;

23 cin >>Name;

24 cout << "Please enter your Address: " << endl;

25 cin >>Add;

26 cout << "Please enter your Handphone number: " << endl;

27 cin >>Tel;

28 }

29 void MemberData::showData(void) //show member's particular

30 {

31 cout << "Member ID is: "<< ID<<endl;

32 cout << "Member Name is: "<<Name<<endl;

33 cout << "Member's Add is: "<<Add<<endl;

34 cout << "Member's Tel is: "<<Tel<<endl;

35 }

36 class NomineeData : public MemberData //Derived from class MemberData allow the user enter

37 //the nominees' particular

38 {

39 private:

40 int N_ID[20];

41 char N_Name[20];

42 public:

43 void N_enterData(int, char);

44 void N_showData(int, char);

45 };

46 void NomineeData::N_enterData(int N_ID, char N_Name)

47 {

48 cout << "Please enter Nominee's ID: "<< endl;

49 cin >> N_ID;

50 cout << "Please enter Nominee's Name: "<< endl;

51 cin >> N_Name;

52 }

53 void NomineeData::N_showData(int, char)

54 {

55 cout << "Nominee's ID is: "<< N_ID << endl;

56 cout << "Nominee's Name is: "<< N_Name << endl;

57 }

58 class Set_Nnum : public NomineeData //Derived from class MemberData to assign no to nominees

59 {

60 private:

61 char "James Tan", "Benny Koh", "Steven Lim", "David Tay", "Mary Tan"; // erroe1:syntax error : 'string';2.unexpected token(s) preceding ';

62 public:

63 void Setname(void);

64 };

65 void Set_Nnum::Setname(void)

66 {

67 "James Tan" = 1; //error3.error C2440: '=' : cannot convert from 'int' to 'const char [10]'

68 "Benny Koh" = 2; //error4.error C2440: '=' : cannot convert from 'int' to 'const char [10]'

69 "Steven Lim" = 3; //error5.error C2440: '=' : cannot convert from 'int' to 'const char [10]'

70 "David Tay" = 4; //error.6error C2440: '=' : cannot convert from 'int' to 'const char [10]'

71 "Mary Tan" = 5; //error7.error C2440: '=' : cannot convert from 'int' to 'const char [10]'

72 }

73 int main()

74 {

75 MemberData showdata;

76 NomineeData N_showdata;

77

78 showdata.enterData; //error8. error C3867: 'MemberData::enterData': function call missing argument list; use '&MemberData::enterData' to create a pointer to member

79 showdata.showData();

80 N_showdata.N_enterData();//error9.'NomineeData::N_enterData' : function does not take 0 arguments

81

82 N_showdata.N_showData();//error10.'NomineeData::N_showData' : function does not take 0 arguments}

err.. acutually now left last 3 errors only ,the rest solved,thanks

Hi cnmsg007

Please try to explain whats your so I can help all some of your is

class Set_Nnum : public NomineeData  //Derived from class MemberData to assign no to nominees
{
private:
    char "James Tan", "Benny Koh", "Steven Lim", "David Tay", "Mary Tan";
public:
    void Setname(void);
};

what is this? How can you define variable like this read book carefully how to create variable, rulation and regulation of creating variable and then try to resolve your problem.

yeah, i found that,thank you.

Looks Like this code is not yours or you don't have a clue about it, because you cannot spot simple mistakes, the errors are guiding you to your mistakes.

You have some problems in the declaration of enum
and then the two function the compiler is highlighting both of them takes "an int and a char" as inputs in order to make them work.

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.