hello there, im new to C++ and i tried to design this code but the code is not running and i there is the code below

#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include <string>
using std::string;
using std::getline;

class staffMember{
public :
	void setFirstName (string fname){
		FirstName = fname; // stores the staff name in the object
      }
	string getFirstName(){
		return fname;
	}
      void setLastName (string lname){
		LastName = lname;
	}
	string getLastName(){
		return = lname;
	}
	void setIdNo (string icno){
		IdNo = icno;
	}
	string getIdNo(){
		return icno;
	}
	void setNationality (string nationality){
		Nationality = nationality;
	}
	string getNationality(){
		return nationality;
	}
	void setReligion (string religion){
		Religion = Religion;
	}
	string getReligion(){
		return religion;
	}
	void setBirthDate ( string birthdate){
		BirthDate = birthdate;
	}
	string getBirthDate(){
		return birthdate;
	}
int main ()
{
int staffNo;
      string fname;
      string lname
	string icno;
	string gender;
	string birthdate;
	string nationality;
	string religion;

	cout<<"Full Name: " <<endl;
	getline( cin, name );
	mystaffMember.setName( name );
	cout<<"Identification Card Number: " <<endl;
	getline( cin, icno );
	mystaffMember.setIdNo( name );
	cout<<"Gender: " <<endl;
	getline( cin, gender );
	mystaffMember.setGender( gender );
	cout<<"Nationality: " <<endl;
	getline( cin, nationality );
	mystaffMember.setNationality( nationality);
	cout<<"Religion: " <<endl;
	getline( cin, religion );
	mystaffMember.setReligion( religion );
	cout<<"Date Of Birth: " <<endl;
	getline( cin, birthdate );
	mystaffMember.setBirthDate( birthdate );

}
void staffMember::genderAllocate()
{
	//Validate gender
	cout<<"Gender(Enter m for Male or f for Female):\n==>";
	char g;
	cin>>g;
	if(g =='m'||g=='M'){
		//m[emp].setgender ("MALE");
		gender = "Male";
	}
	else if(g=='f'||g=='F'){
		//m[emp].setgender("FEMALE");
		gender = "Female";
	}
	else{
		cout<<"Invalid!\n";
	    GenderAllocate();
	}
}

void staffMember::religionAllocate()
{
	//validate religion
	cout<<("Religion:\n b->Buddhist\n c->Christian\n h->Hindu j->Jewish m->Muslim\n  n->Non-Religious\n==>");
	string r;
	cin>>r;
	if (r=="b"||r=="B")
		religion=("Buddhist");
	else if(r=="c"||r=="C")
		religion=("Christian");
	else if (r=="h"||r=="H")
		religion=("Hindu");
	else if (r=="j"||r=="J")
		religion=("Jewish");
	else if(r=="m"||r=="M")
		religion=("Muslim");
	else if(r=="n"||r=="N")
		religion=("Non-Religious");
	else
	{
		cout<<("Invalid!\n ");
		religionAllocate();
	}
}
}

Can you be more specific about what's wrong? Line 22 for example is an error -- you don't need the equals sign.

remove the = sign in line 22. And ,again, nowadays we programmers are looking for ways to avoid writing too may lines of code. What you're doing is not advisable:

#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <string>
using std::string;
using std::getline;

Why not just write it this way:

#include<iostream>
#include<string>
using namespace std;

I'm not saying your style's wrong; but it's better to slim down on your lines of code.

> I'm not saying your style's wrong; but it's better to slim down on your lines of code.
The two styles do different things. The first style only makes the specified names available. The second style makes all names in the namespace available. It is easier to get name collisions with the second style. Ed recommends avoiding the second style unless you are careful not to use standard names or have a naming convention that guarantees no collisions with the std namespace.

commented: good explanation +2
commented: Yep +4
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.