Array/Struct Complicated Problem

Program is above, Actual Problem is Below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <string>
#include <fstream>


using namespace std;

struct submissions
	{
		
		int time_type;
		int teamname;
		int problem;
		int outcome;
	};

struct time;
{
	int min;
	int hour;
};

struct teams
{
	int teamname;
};

int results [];
int n;
int Myarray[7];

int main()

{
	ifstream inputFile("teams.txt");
	ifstream inputFile("submissions.txt");

	string y;
	inputFile >> y;


	//int t;
	//for(int t=0; t<=20;t++)
	int rank [5];
	int probnum;
	probnum = 0;
	int numsolved = probnum+1;

	for(int s=0; s<=20;s++)
	{
		submissions.time_type.time.hour;
		submissions.time_type.time.min;
		submissions.teamname;
	    submissions.problem;
		submissions.outcome;
	}




	

	cout << "Rank" << ""<< "Name" <<""<< "Solved" <<""<< "Time" << endl;

	cout << rank << ""<< submissions.teamname <<""<< numsolved <<""<< submissions.timetype.time.hour,submissions.timetype.time.min << endl;
	cout << rank << ""<< submissions.teamname <<""<< numsolved <<""<< submissions.timetype.time.hour,submissions.timetype.time.min << endl;
	cout << rank << ""<< submissions.teamname <<""<< numsolved <<""<< submissions.timetype.time.hour,submissions.timetype.time.min << endl;
    cout << rank << ""<< submissions.teamname <<""<< numsolved <<""<< submissions.timetype.time.hour,submissions.timetype.time.min << endl;
	cout << rank << ""<< submissions.teamname <<""<< numsolved <<""<< submissions.timetype.time.hour,submissions.timetype.time.min << endl;
	
	system("pause");
	return 0;
}


At a contest, a team (3 – 4 members) is given one computer and a set amount of time (typically 4 – 5 hours) to write programs which solve a set of problems (usually 5 – 7). Teams are then ranked by the number of problems they are able to successfully solve. If several teams solve the same number of problems, a team whose total time to solve those is less than that of another is ranked higher. If team A solved 2 problems, the first being solved one hour into the contest, and the second 1-1/2 hours into the contest, their total time is 60 + 90 = 150 minutes. If a second team, B, solved their first problem in 45 minutes, and a second correct one after 2 hours, team B’s total time is 45 + 120 = 165 minutes. Thus A would be ranked above B.
Those calculations imply that both teams had correct solutions on both of their problems the first time they submitted each solution. However, there is a time penalty of 20 minutes imposed on a team for each incorrect submission they have had. The penalty is only imposed once the team has a correct submission for that particular problem. Thus if, as above, team A had submitted two incorrect solutions to one of their problems that they ultimately got correct in 1 hour, the total time for that problem is 60 + 2(20) = 100 minutes. If that is the only change from above, team B would instead be ranked above team A since it had the lesser total time (165 minutes as opposed to 190 minutes). Penalty points are only added in after a team successfully solves that problem. If a team never has a correct solution to a given problem, but has 5 incorrect submissions, there is no penalty time added in for that problem.
For this project, you are to determine the rankings for teams competing in a programming contest. Input will come from two files. The first,“ teams.txt” will contain a list of team names, one per line. Although the number of teams is not known, hardware limitations dictate that there can never be more than 20 teams allowed to participate. The second file, “submissions.txt” will be a list of all submissions, in chronological order, throughout the contest, one per line. Each line will contain, in the given order:
The time of the submission (in hh:mm format)
The team name (a single word with no blanks)
The problem number (1-5)
The judged outcome of that submission – ‘C’ if correct, ‘I’ if incorrect
Thus, the line: 1:06 Coders 4 I indicates that team Coders submitted a solution to problem 4 and it was deemed an incorrect solution. The contest begins at noon (12:00).
Your program is to create a well-formatted table listing the teams in rank order and including the rank, the team name, the total number of problems solved, and the total time points assessed. Teams solving the same number of problems with the same number of total points should have the same rank. This information should be written to the file results.txt.

For example.
if the contents of teams.txt is
Coders
GroupA
Winners
Excellence
Undefeated




and the contents of submissions.txt is
12:55 GroupA 3 C
1:18 Winners 3 I
1:23 Winners 3 C
2:24 Excellence 4 C
2:57 Undefeated 2 I
3:15 Winners 2 C
3:20 Coders 2 C
3:42 Undefeated 2 I
3:45 GroupA 4 C
3:55 GroupA 1 C


Then the contents of results.txt would be
RANK NAME SOLVED TIME
1 GroupA 3 515
2 Winners 2 298
3 Excellence 1 144
4 Coders 1 200
5 Undefeated 0 0
Nobody is going to read that wall of text. You need to be more specific.
Topic archived. No new replies allowed.