QuestionQuestion

Suppose that there are " students in a class, and that each student has taken / tests. For any two students A and B, we say that A beats B if both of the conditions below are satisfied:
A's score is greater than or equal to B's score on every test.
There exists at least one test in which A's score is greater than B's score.
For every student A, we say that A is unbeaten if no students beats A.
Write a program to find the number of students who are unbeaten. Then return another number according to the following table:
5th digit of Student ID             Another number to be returned
Odd                                        The average score in the first test among the unbeaten
                                                students. Display the value in the default format.
Even                                        The minimum score in the first test among the
                                                 unbeaten students.
Remarks: Both " and I are positive integers. The score obtained by a student from any test is a non-negative integer (so, a score of 60.5 is not possible). Do not assume that the maximum score of a test is 100.
Assumptions. The maximum value of " is 1,000, and the maximum value of / is 50.
User inputs:
1. The first line contains a number indicating the value of n.
2. The second line contains a number indicating the value of t.
3. Each of the subsequent n lines contains / numbers, indicating the scores of a student on the / tests. On each line, the ith number corresponds to the score of the ith test. There is a white space between any two scores.
Program outputs:
1. The first line contains the number of students who are unbeaten.
2. The second line contains the number indicated in the table above.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

24// Additional Assignment
// Program template file

// Insert more header files when necessary
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
using namespace std;


void Q5()
{
int students[1000][50]; // 2D array to hold students tests
bool unbeaten[1000]; // array to hold which student is unbeaten
int n, t;
cin >> n >> t;

// Read the students tests and set all students to unbeaten
for (int i = 0; i < n; i++)
{
for (int j = 0; j < t; j++)
{
cin >> students[i][j];
}
unbeaten[i] = true;
}
int cnt = 0; // Counter of unbeaten students

// Loop all students
for (int i = 0; i < n; i++)
{
int j = 0;
// compare student with all students while it is unbeaten
while (unbeaten[i] && (j < n))
{
if (j != i) // skip comparison with self
{
bool equal...

By purchasing this solution you'll be able to access the following files:
Solution.cpp.

50% discount

Hours
Minutes
Seconds
$23.00 $11.50
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats