M
M Maloney
Hey all,
I was wondering if anyone could help me with this problem I
have:
Given a text file like this:
8
=ABC
18.00 Dr Who: Underworld
18.30 Collectors
19.00 News
19.30 The 7.30 Report
20.00 Catalyst
=Seven
18.00 Seven News
18.30 Today Tonight
19.00 Home and Away
19.30 My Restaurant Rules
20.30 **END
=31
19.00 Other
20.00 **END
I have to produce a program guide like this:
+-------+-------+-------+-------+-------+-------+
| | 18.00 | 18.30 | 19.00 | 19.30 | 20.00 |
+-------+-------+-------+-------+-------+-------+
| ABC | Dr Wh | Colle | News | The 7 | Catal |
+-------+-------+-------+-------+-------+-------+
| Seven | Seven | Today | Home | My Restaurant |
+-------+-------+-------+-------+-------+-------+
| 31 | | Other | |
+-------+---------------+---------------+-------+
Some features to note: channel names are right-justified with a
cell, everything else is leftjustified;
cell content is truncated to fit cell width; ‘+' is only used in row
separators where there is a ‘|' above or below; channel content may
not fill an entire row.
The description file contains:
• a line containing a single integer specifying the cell width;
thereafter
• lines beginning with ‘=' start a new channel and have the channel
name following the ‘='
• other lines have a time of the form integer.integer followed by a
programme name; time resolution will not be finer than half-hour
increments
• lines are separated with the conventional ASCII LF character
A programme runs from its specified starting time until the start
of the next programme or for half-an-hour if there is no next
programme. The special entry ‘**END' may be used to terminate a
programme entry before the start of the next programme or to given the
last programme of the day a running time of more than half-an-hour,
e.g. a programme may run from 5.30 to 6.00 but the next programme may
not start until 7.00. Programme entries may span more than one column.
Cell width includes the closing but not the opening character so the
above table has a cell width of 8. A table of cell width w with n
columns will have a total line length of n*w+1. The first column
contains the channel names. The first row contains the times. The
ASCII characters ‘-', ‘|' and ‘+' should be used to build the table;
‘+' should be used in the row separator when there
is a ‘|' above or below. At least one space should appear on either
side of ‘|' characters. Depending on the justification sometimes at
most one space should appear.
Each column is half an hour, but a programme may run for longer,
thus consuming two or more columns
I am having greatt difficulty making this work in good C++ O-O
style. If anyone could help me out, that would be greatly appreciated.
Even giving me some skeleton code, or describing how I should begin
would be fine.
Thanks in advance.
I was wondering if anyone could help me with this problem I
have:
Given a text file like this:
8
=ABC
18.00 Dr Who: Underworld
18.30 Collectors
19.00 News
19.30 The 7.30 Report
20.00 Catalyst
=Seven
18.00 Seven News
18.30 Today Tonight
19.00 Home and Away
19.30 My Restaurant Rules
20.30 **END
=31
19.00 Other
20.00 **END
I have to produce a program guide like this:
+-------+-------+-------+-------+-------+-------+
| | 18.00 | 18.30 | 19.00 | 19.30 | 20.00 |
+-------+-------+-------+-------+-------+-------+
| ABC | Dr Wh | Colle | News | The 7 | Catal |
+-------+-------+-------+-------+-------+-------+
| Seven | Seven | Today | Home | My Restaurant |
+-------+-------+-------+-------+-------+-------+
| 31 | | Other | |
+-------+---------------+---------------+-------+
Some features to note: channel names are right-justified with a
cell, everything else is leftjustified;
cell content is truncated to fit cell width; ‘+' is only used in row
separators where there is a ‘|' above or below; channel content may
not fill an entire row.
The description file contains:
• a line containing a single integer specifying the cell width;
thereafter
• lines beginning with ‘=' start a new channel and have the channel
name following the ‘='
• other lines have a time of the form integer.integer followed by a
programme name; time resolution will not be finer than half-hour
increments
• lines are separated with the conventional ASCII LF character
A programme runs from its specified starting time until the start
of the next programme or for half-an-hour if there is no next
programme. The special entry ‘**END' may be used to terminate a
programme entry before the start of the next programme or to given the
last programme of the day a running time of more than half-an-hour,
e.g. a programme may run from 5.30 to 6.00 but the next programme may
not start until 7.00. Programme entries may span more than one column.
Cell width includes the closing but not the opening character so the
above table has a cell width of 8. A table of cell width w with n
columns will have a total line length of n*w+1. The first column
contains the channel names. The first row contains the times. The
ASCII characters ‘-', ‘|' and ‘+' should be used to build the table;
‘+' should be used in the row separator when there
is a ‘|' above or below. At least one space should appear on either
side of ‘|' characters. Depending on the justification sometimes at
most one space should appear.
Each column is half an hour, but a programme may run for longer,
thus consuming two or more columns
I am having greatt difficulty making this work in good C++ O-O
style. If anyone could help me out, that would be greatly appreciated.
Even giving me some skeleton code, or describing how I should begin
would be fine.
Thanks in advance.