Answer to Question #255962 in C++ for Kicker

Question #255962

You are required to build a system that can generate a random winning scenario for the T20 cricket world cup. There12 teams which will play knock-out matches in the first round. losing team is out and the winning team moves on. From the twelve teams, six winning teams will play another knock-out match. From these six teams, three winning teams will play against each other on the round robin basis (i.e. team A plays against team B, team B plays against team C, and team C plays against team A). The top two teams from this round will move to the final match. In case all the teams win one match each at this stage, then there will be a toss to move one team to the final while the other two teams will play against each other and the winner moves to the final. The winner of the final match is champion. generate random numbers for matches and toss You are required to use if-else (if-else-if) structure to run the tournament and generate one complete winning scenario randomly.


1
Expert's answer
2021-10-24T13:53:34-0400

For generating a random number of matches, you can use the rand() function from std.

#include <iostream>

int main() {
  for (int i = 0; i < std::rand(); i++) {
    std::cout << std::rand() << std::endl;
  }  
  return 0; 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS