Description
VE 280 Lab 4
Background:
Haruhi enjoyed watching Attack on Titan together with Kyon. However, she got quite upset about the last chapter and believed that she could produce a much better work than Isayama Hajime. The cultural festival was just around the corner, so she decided to call up the members of SOS brigade and produce her own short movie The Adventures of Mikuru Asahina Episode 00.
This short movie is mainly about the war between Asahina Mikuru, a cute girl from the future, and Nagato Yuki, a silent, expressionless and inhospitable alien girl.
They need 1 costume for Mikuru, 2 guns and 100 bullets for each scene.
Yamazaki’s Model Shop sells bullets and guns, and Omori’s Costume Store sells costumes.
Ex1. How Many Scenes Could They Produce?
Related Topics: exceptions, program arguments.
For Ex1, you are going to simulate the process of purchasing the needed materials for the movie. The following are some basic rules:
They will first visit Omori’s Costume Store and then Yamazaki’s Model Shop . If
Yamazaki’s Model Shop is open, they will first buy guns and then buy bullets. During the procedure, if any “exception” happens (eg: Omori’s Costume Store is closed, bullets in
Yamazaki’s Model Shop are not enough, etc), the buying process will end (exception caught). See ex1.cpp for details.
The input will be a sequence of numbers read from program arguments (6 numbers in total):
number of scenes (int) status of Omori’s Costume Store (1 for open and 0 for closed) status of Yamazaki’s Model Shop (1 for open and 0 for closed), number of costumes remaining in Omori’s Costume Store (int) number of guns remaining in Yamazaki’s Model Shop (int) number of bullets remaining in Yamazaki’s Model Shop (int)
For example, if the program name is ex1 and the arguments are ” 3 1 1 10 5 355 “, i.e. ,
./ex1 3 1 1 10 5 355 then they will make 3 scenes, both stores are open, 10 costumes remain in Omori’s Costume Store , 5 guns and 355 bullets remain in Yamazaki’s Model Shop .




