Need guidance

I have problems with this task. My code is shitty so I won't upload it.

The drama theater hall plan is described by a table of units (1) and (0). 1 - means that the room is occupied, 0 - not occupied. The first row of the table corresponds to the first row of the theater hall, the second to the second and t. t Tickets in the first two queues cost 100 Eur, in the third and fourth seals - 70 Eur, and the remaining - 40 Eur.

Create a program that calculates the amount of money collected for the sold tickets and the average fare.

The data file in the Data.txt file contains the occupancy schedule for the room. The first line contains the number of queues in the room and the number of places in each row.

In the Results.txt file, you need to deduce the amount of money collected and the average ticket price for the tickets sold.

Requirements for the program:

1. Create a function calculating the price of one place, depending on the order.


2. Create a void function that calculates the amount of money received for tickets sold and the average ticket price.

Data.txt _______________ Result.txt (can't upload pictures so here it is)

0 1 0 1 0 1 1 1 1 1 | 3080 70.00
0 1 1 1 1 1 1 1 1 0 |
0 0 1 1 1 1 1 1 1 0 |
0 1 1 1 1 0 1 0 1 1 |
0 1 1 1 1 1 0 1 1 1 |
0 1 1 1 0 1 1 0 1 1 |
_________________|______________
_________________| 1330 83.12
0 1 0 1 0 1 1 1 1 1 0 |
0 0 0 0 0 0 0 0 0 0 0 |
1 0 1 1 1 1 1 1 1 0 1 |

Spent the last hour and a half scratching my head. Would really appreciate the help.
Last edited on
My code is shitty so I won't upload it.

Should we now say that our answers are shitty so we won't upload them?


The job is straightforward:
1. Read data
2. Count
3. Show result

If one does 1 and 2 in separate steps, then each subtask is really simple, but one has to store the data to pass it from 1 to 2.

If one does counting already while reading, then there is no need to store data at all but code more monolithic.
Topic archived. No new replies allowed.