c++

i have to to do this but im clueless
A. Write a program that will interview 10 persons who wants to join the kluklux clan.
• The program will ask three questions
1. What is your sex
2. Do you work in a n office
3. What is your race
If the sex is Male and the race is white, and the person works in an office then they are eligible to join the clan
The program will output the number of persons that are eligible to join the clan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  #include<iostream>
#include<string>
using namespace std;
int main(){
	int femalecount=0,malecount=0;
	string race,office,sex;
for(int i=0; i<10; i++)
{
	cout<<"\nwhat is your sex?? answer using f(female) or m(male) ";
	cin>>sex;
	cout<<"\nwhat is your race?? answer using b(black) or w(white) ";
	cin>>race;
	cout<<"\ndo you work in a office?? y(yes) n(no)";
	cin>>office;
if ((sex=="f")||(sex=="m"))&&((race=="w")||(race=="b"))&&((office=="y")||(office=="n"));{

	cout<<"\nyou are eligible to join clan ";
}
}
}
Last edited on
this will help you, If any issue then please let us know.

1
2
3
4
5
if(sex=="m" && race==""w" && office=="y")

OR

if(!strcmp(sex.c_str(),"m") && !strcmp(race.c_str(),"w") && !strcmp(office.c_str(),"y")) 
Last edited on
Topic archived. No new replies allowed.