A simple function
#include<iostream>
#include<string>
#include<conio.h>
#include<stdlib.h>
using namespace std;
class name{
//*******************************
private:
string fName;
string mName;
string lName;
int ppl;
//*******************************
public:
int getPpl(){return ppl;}
void setPpl(int ppl){this->ppl=ppl;}
name(){fName;mName;lName;ppl=0;}
string getfName(){ return fName;}
string getmName(){ return mName;}
string getlName(){ return lName;}
void setfName (string Aname){this->fName=Aname;cout<<" X. Please Enter First Name "; cin>>fName;}
void setmName (string Bname){this->mName=Bname;cout<<" X. Please Enter Middle Name "; cin>>mName;}
void setlName (string Cname){this->lName=Cname;cout<<" X. Please Enter Last Name "; cin>>lName;}
//-----------------------------------------
void enterName(){
cout<<endl;
cout<<endl;
cout<<" X. Please enter the Names of people \n";
string x;string y;string z;
setfName(x);
setmName(y);
setlName(z);
}
/-----------------------------------------
void showNames(){
for(int x=1;x<2;x++){
cout<<endl;
cout<<" X. The Name is:: "<< getfName();
cout<<" "<<getmName();cout<<" "<<getlName();
//------------------------------------------
}}};
//........................................
int main(){
int ppl;
name nam;
nam.enterName();
nam.showNames();
cout<<endl;
cout<<"\t";
system("pause");
cout<<endl;
return 0;
}