hello everyone. i'm calculating certain 100 people that have completed a questionnaire and my program has to dertermine the number of males between20-30 and their highest grade which is grade 12,also the program has to determine the number of people above 32 and their highest grade which is tertiary as well as the program has to determine the number of females between 20-30 and their highest grade which is tertiary. this is what i did.

#include<iostream>
using namespace std;
int main()
{
int maleage32;int femaleage32;int maleagebetween20and32;int femaleagebetween20and32;
int highestgrade;int tertiary;int gender;int malebetween20and30=1;
int i;int age;int age20;int age32;int agebetween20and32;
int male;int female;int heterosexual;int between20and30;
int highestgrade10;int highestgrade12;int olderthan30;

int total;int femalebetween20and30=2;int peopleolderthan30=3;
char m=male; char gendermale;
char f=female;char genderfemale;
char h=heterosexual;char genderheterosexual;
for (i<100;i++;)
highestgrade10=1;
highestgrade12=2;
tertiary=3;
m=male;
f=female;
h=heterosexual;
cout<<"what is your highest grade?"<<endl;
cin>>highestgrade;

age20=1;
maleagebetween20and32=2;femaleagebetween20and32;
maleage32=3;femaleage32=2;
 
cout<<"how old are you?"<<endl;
cin>>age;
gendermale =m;
genderfemale=f;
genderheterosexual=h;
cout<<" what is your gender?"<<endl;
cin>>gender;

total=malebetween20and30+femalebetween20and30+peopleolderthan30;
heterosexual=femalebetween20and30+malebetween20and30;
female=femalebetween20and30;
male=malebetween20and30;
if (gender=m,highestgrade=2)
cout<<"number of males between 20 and 30 and the highest grade12";
else if (gender=heterosexual,highestgrade=3)
cout<<"the number of people older than 30 with a tertiary qualification";

else if(gender=f,highestgrade=3)
cout<<"the number of females between 20 and 30 with a tertiary qualification";

else
cout<<"the total of males,female and people older than 30 is"<<total;
 
 
 
 
return 0;

so my problem is this program doesn't show the neccesary results that i want pleaee help.i have tried but i need help

Recommended Answers

All 2 Replies

what do you mean by tertiary ? It has several meanings, including the age of dinosaurs, or chemestry, or the third of something. I can only assume you mean it to be the third of something, but you used it twice in the description of the program.

what is the incomplete loop at line 15 supposed to do? Looks like it only sets the value of highestgrade10 to the same number 100 times.

tertiary refers to the higher grade than matric so it refers to any qualification more than matric,example a diploma,degree etc

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.