#include<iostream.h>
#include<string.h>
#include<conio.h>
class voter
{
private:
char voterid[10];
char votername[30];
char voteraddr[30];
char phone[15];
int age;
char status[20];
public:
void getvoterdetails()
{
cout<<"get voterid";
cin>>voterid;
cout<<"voter's name";
cin>>votername;
cout<<"voter's address";
cin>>voteraddr;
cout<<"phone number";
cin>>phone;
cout<<"voter's age";
cin>>age;
if(age>18)
strcpy(status,"eligible");
else
strcpy(status,"not eligible");
}
void printvoterdetails()
{
cout<<"voter's information\n";
cout<<"--------------------\n";
cout<<"voter id:"<<voterid<<"\n";
cout<<"voter name:"<<votername<<"\n";
cout<<"voter addr:"<<voteraddr<<"\n";
cout<<"phone no:"<<phone<<"\n";
cout<<"voter's age:"<<age<<"\n";
cout<<"status:"<<status<<"\n";
cout<<"-----------------\n";
}
};
void main()
{
voter v[10];
clrscr();
for(int i=0;i<10;i++)
v[i].getvoterdetails();
clrscr();
cout<<"printing voter's information\n";
cout<<"--------------------\n";
for(i=0;i<10;i++)
v[i].printvoterdetails();
getch();
}
#include<string.h>
#include<conio.h>
class voter
{
private:
char voterid[10];
char votername[30];
char voteraddr[30];
char phone[15];
int age;
char status[20];
public:
void getvoterdetails()
{
cout<<"get voterid";
cin>>voterid;
cout<<"voter's name";
cin>>votername;
cout<<"voter's address";
cin>>voteraddr;
cout<<"phone number";
cin>>phone;
cout<<"voter's age";
cin>>age;
if(age>18)
strcpy(status,"eligible");
else
strcpy(status,"not eligible");
}
void printvoterdetails()
{
cout<<"voter's information\n";
cout<<"--------------------\n";
cout<<"voter id:"<<voterid<<"\n";
cout<<"voter name:"<<votername<<"\n";
cout<<"voter addr:"<<voteraddr<<"\n";
cout<<"phone no:"<<phone<<"\n";
cout<<"voter's age:"<<age<<"\n";
cout<<"status:"<<status<<"\n";
cout<<"-----------------\n";
}
};
void main()
{
voter v[10];
clrscr();
for(int i=0;i<10;i++)
v[i].getvoterdetails();
clrscr();
cout<<"printing voter's information\n";
cout<<"--------------------\n";
for(i=0;i<10;i++)
v[i].printvoterdetails();
getch();
}
No comments:
Post a Comment