answersLogoWhite

0


Best Answer

#include<iostream>int main () {

int age, female=0, male=0, fcount=0, mcount=0;

char sex;

for (int voter=0; voter<10; ++voter) {

std::cout << "Enter the voter's age and gender: ";

std::cin >> age >> sex;

switch (sex) {

case 'm':

case 'M': ++mcount; male += age; break;

case 'f':

case 'F': ++fcount; female += age; break;

}

}

std::cout << "Average male age: " << male / mcount << std::endl; std::cout << "Average female age: " << female / fcount << std::endl;

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

#include <iostream>

using namespace std;

int main()

{

int age[10], total;

cout << "Enter the age of 10 students: " << endl;

for(int i = 0; i < 10; i++)

{

cin >> age[i];

total += age[i];

}

cout << "The average age is: " << total / 10 << endl;

char wait;

cin >> wait;

return 0;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Do Write a program in c plus plus to enter 10 voters age and display the average male voters age and average female voters age using loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Forty percent of all registered voters in a national election are female A random sample of 5 voters is selected The probability that the sample contains 2 female voters is?

0.3456


Beside the you the people program are schools doing enough to edgecate voters?

no


The average number of voters per precinct is?

400


What is The average number of voters per precinct?

400


The term grass roots refers to?

Average voters.


A researcher is curious about the average IQ of registered voters in the state of Florida The entire group of registered voters in Florida is an example of a?

Population


What are the average numbers of voters per precinct?

The question needs more detail.


What is the average age of voters on American idol?

to try out you have to be ages 16-28


Who was the first president to be elected with the help of woman voters?

President Warren Harding was the first American president to be elected with the support of female voters. The election was in 1920. Harding was the Republican representative in the presidential election for that term.


How do Jewish voters vote?

They tend to be more liberal than average on economic and cultural issues.


What is the smallest voting district in the US called?

The smallest voting district in the US is called a precinct. Kansas had the smallest average precinct size with 437 voters per precinct. The District of Columbia had the largest average size at 2,704 voters per precinct.


What does the term Grass Roots refer to?

the structure of grass roots is that it come from the soil and is born from the grass