The cinema's three orders are in orders, each with a film, number of tickets and price. Print one line per order, like Up: 2 x 9 = 18, and add it to total; the Total: line at the end is already written.
Up: 2 x 9 = 18 Coco: 3 x 8 = 24 Wall-E: 1 x 12 = 12 Total: 54
#include <stdio.h>
struct Order {
char film[20];
int tickets;
int price;
};
int main(void) {
struct Order orders[] = {
{"Up", 2, 9},
{"Coco", 3, 8},
{"Wall-E", 1, 12}
};
int total = 0;
for (int i = 0; i < 3; i++) {
// your code here: work out this order's cost, print its line, add it to total
}
printf("Total: %d\n", total);
return 0;
}
Run tries the examples. When they look right, Submit.