0

Hi iam working on a problem given to me by my teacher.The problem is
!.People from different states send their application to participate in the dance competition organised at the country level.Only 30 people will be selected to take par in the competition.Participants will be selected randomly from one state.No more than 5 participants can take part in the competition.We have to write a function to print names of 20 people selected randomly to take paet in the competition.

Can anyone help me on this question.

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by plgriffith
0

??? First you say that 30 people will be selected to compete. Then, you say 5 participants can compete. Then, you want the names of 20 competitors. Either make up your mind or clarify your assignment.

0

??? First you say that 30 people will be selected to compete. Then, you say 5 participants can compete. Then, you want the names of 20 competitors. Either make up your mind or clarify your assignment.

Actually 30 peoples are to be selected 5 from each city and there are 6 cities given.These 5 people should be selected randomly

0

I would have an array of names of people from each city. That is, have 6 arrays, one for each city.
Then, have a for loop like such:

for (i = 0; i < 5; i++)
{
     result = rand();
     contestant[6*i + 1] = denver[result];
     contestant[6*i + 1] = cleveland[result];
     ........
     ........
     ........
     ........
}

That will fill up the 30 contestant slots with 5 from each city.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.