The only error stated is at "N_showdata.N_enterData();" which says "error C2660: 'NomineeData::N_enterData' : function does not take 0 arguments"
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
class MemberData
{
private:
int ID ;
char Name[60];
char Add[60];
char Tel[15];
public:
void enterData();
void showData(void);
};
void MemberData::enterData()
{
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)
{
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:
char N_ID[20];
char N_Name[20];
public:
void N_enterData(char N_ID, char N_Name);
void N_showData(void);
};
void NomineeData::N_enterData(char 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(void)
{
cout << "Nominee's ID is: "<< N_ID << endl;
cout << "Nominee's Name is: "<< N_Name << endl;
}
class ShowNname : public NomineeData //Derived from class MemberData
{
private:
string JamesTan, BennyKoh, StevenLim, DavidTay, MaryTan;
public:
void Showname();
};
void ShowNname::Showname(void)
{
cout << "Nominee No.1 "<<" JamesTan"<<endl;
cout << "Nominee No.2 "<<" BennyKoh"<<endl;
cout << "Nominee No.3 "<<" StevenLim"<<endl;
cout << "Nominee No.4 "<<" DavidTay"<<endl;
cout << "Nominee No.5 "<<" MaryTan"<<endl;
}
int main()
{
MemberData show_data;
NomineeData N_showdata;
ShowNname show_name;
show_data.enterData();
show_data.showData();
N_showdata.N_enterData();
N_showdata.N_showData();
show_name.Showname();
int Vote_Amount[6]={0};//set amunt of votes
int key=0;
cout << "Please vote nominee by enter the noimee number" << endl;
while((key=getch())!=0x27)
{
switch(key)
{
case '1':Vote_Amount[1]++;break;
case '2':Vote_Amount[2]++;break;
case '3':Vote_Amount[3]++;break;
case '4':Vote_Amount[4]++;break;
case '5':Vote_Amount[5]++;break;
}
for(int i=1;i<6;i++)
cout<< "Nominee No."<< i <<" won "<<Vote_Amount[i]<< " vote(s)"<<endl;
}
return 0;
}