pleas ehelp with this program im clueless in what to do for it

• 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
this is far as i have reached

#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 ";
}

Recommended Answers

All 9 Replies

What is the question? Your conditional statement is wrong. Look on line 15, why would you need ;?

that is a typo
im lost after here

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;

}




}

You still don't explain what the question is. What is wrong with this? What do you want to do.. We cannot help you, if we don't know what it is you're trying to do.

this is the question i apologize thought i was already declared

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

That's not a question, it's simply a statement of the program you have to write. -- we don't do homework for people. You write the program then ask specific question(s) about what you don't understand.

well, check this out.. as per your code, I've corrected a few things but it doesn't answer your homework sorry. Like he rightly said, it's not done here... see if you can build on it

#include<iostream>
#include<string>
using namespace std;
int main(){
int femalecount=0,malecount=0;
char 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=='m')&&(race=='w')&&(office=='y')){
    cout<<"\nyou are eligible to join clan ";}

return 0;}
}

samsondadson3

on line 18 the return statement must not be inside that bracket.
Return must be inside the main's as it is returning int main() fuction.

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.