I need to create a C++ program to simulate a Round Robin Tournament.
For example: if a user enters 4, a 4 team tournament would output:
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
My goal is to create this program using a two dimentional array, however I am unsure how to go about doing initializing everything. How do I write a constructor for this? The following is the class declaration I must use, things can be added, but nothing can be removed from it.
class Scheduler
{
public:
Scheduler(); // default constructor
Scheduler(int ini_teams); // constructor
// generate the schedule for the number of team = teams
void generateSchedule();
// display the table content of the schedule for each team
void print();
// destructor
~Scheduler();
int check();
// more member functions here ...
private:
int teams; // the number of teams to be scheduled
int** Arrange;
// the two dimensional vector to represent the
// scheduling table for each team
};
Any help would be greatly appreciated.
An 8 team tournament would output:
1 2 3 4 5 6 7 8
2 1 4 3 6 5 8 7
3 4 1 2 7 8 5 6
4 3 2 1 8 7 6 5
5 6 7 8 1 2 3 4
6 5 8 7 2 1 4 3
7 8 5 6 3 4 1 2
8 7 6 5 4 3 2 1
The schedule for 16 teams:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15
3 4 1 2 7 8 5 6 11 12 9 10 15 16 13 14
4 3 2 1 8 7 6 5 12 11 10 9 16 15 14 13
5 6 7 8 1 2 3 4 13 14 15 16 9 10 11 12
6 5 8 7 2 1 4 3 14 13 16 15 10 9 12 11
7 8 5 6 3 4 1 2 15 16 13 14 11 12 9 10
8 7 6 5 4 3 2 1 16 15 14 13 12 11 10 9
9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8
10 9 12 11 14 13 16 15 2 1 4 3 6 5 8 7
11 12 9 10 15 16 13 14 3 4 1 2 7 8 5 6
12 11 10 9 16 15 14 13 4 3 2 1 8 7 6 5
13 14 15 16 9 10 11 12 5 6 7 8 1 2 3 4
14 13 16 15 10 9 12 11 6 5 8 7 2 1 4 3
15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
I need to create a C++ program to simulate a Round Robin Tournament. For example: if...
This needs to be in C++
Problem3.cpp
Problem3.h:
Given a matrix, clockwise-rotate elements in it. Please add the code to problem3.h and problem3.cpp, provided. Input 4 Output: 1 8 For 4*4 matrix Input: 4 7 9 10 11 12 13 14 15 16 Output: 9 10 6 4 13 11 7 8 14 15 16 12 #include "problem3.h" 2 3 void rotatematrix(int m, int n, int mat[][MAX]) 4 //write your code here 5 1 #ifndet LAB3 PROBLEM3 2 #define LAB3PROBLEM3...
Five processes arrive to run on a CPU. The scheduler puts them in its data structure. The table below lists the processes, how much CPU time each will need, and the priority of each process. One(1) is the highest priority and 4 is the lowest priority. Process CPU time needed Priority P1 P2 P3 NNW-W a. The scheduler uses First Come First Serve to schedule the jobs. Fill in the time line below showing at what time each process starts...
For C++ Write a program that randomly generates 100 integers and sorts them using radix sort. Note: Your output would not be the same as this sample output due to the randomness. Sample output: 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7...
I need some help with this question.
Create a table of values and an associated graph that are concave up twice and concave down once. y 1 3 2 3 3 4 7 5 12 6 14 7 15 8 14 9 11 10 6 11 3 12 2 13 14 7 15 13
I have a table that looks like this. 1234 5678 9101112 I need to use this code public class Lab8 { public static void main(String argv[]) { int ar[][] = new int[3][4]; int n = 1; for (int i=0; i < ar.length; i++) { for (int j=0; j< ar[i].length; j++) { ar[i][j] = n; n++; } } // print out the elements of the array // left to right, top to bottom for (int i=0; i < ar.length; i++) {...
I posted this question earlier but realized that the code was not easy to test since it was just screenshots and not text so I am reposting it: I'm very new at working with file streams, and I'm having trouble with a HW assignment I have to work on. For the assignment I have to read an input file named "MagicSquaresIn.txt" (included at the bottom) and I have to check whether they are normal, associative, and panmagic. To check that...
In Java, create a program implementing the functionalities of a standard queue in a class called Queue3503. You will test the functionalities of the Queue3503 class from the main() method of the Main class. In a queue, first inserted items are removed first and the last items are removed at the end (imagine a line to buy tickets at a ticket counter). Do NOT change your class name from "Main". The Main class should come first in your code. Your filename should be "Main.java". The Queue3503 class will contain:...
18.12 What does the following program do? (Please explain briefly) 1 // Exercise 18.12: MysteryClass.java 2 public class MysteryClass { 3 public static int mystery(int[] array2, int size) 4 if (size == 1) { 5 return array2[0]; 6 } 7 else { 8 return array2[size - 1] + mystery(array2, size - 1); 9 } 10 } 11 12 public static void main(String[] args) { 13 int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 14 15...
Problem 6. The set (Z19 − {0}, ·19) is a group with the
indicated operation; see the attached table. a.) Show that H = {1,
7, 8, 11, 12, 18} is a subgroup. b.) List all the right cosets of
H. c.) Show that if Hy = Hx then xy−1 ∈ H. [Make sure to give a
reason for each step.] d.) Show that φ : H → Hx defined by φ(h) =
hx is one-to-one and onto. [Use the...
A group of 10 friends are playing a game of guessing the outcome of a tournament played among 8 teams (labeled team 1 to team 8) with a fixed schedule as follows. In round 1, team 1 plays against teams 2, team 3 plays against team 4, team 5 plays against team 6, and team 7 plays against team 8. In round 2, the winner of (1,2) plays against the winner of (3,4), the winner of (5,6) plays against the...