Help me homework c++ The shots file holds a list of shots (imagine some hitscan weapon in a video game like a shotgun or something). Each shot has an origin and a direction. The origin is an (x,y) coordinate, like (5,3). The direction is a slope and whether the shot is traveling along that slope or in the reverse. A slope of "Vertical" means that the shot is travelling straight up and down. The format is: x_location y_location slope(either a number like 2.1 or a non-number meaning "Vertical") forwards(1 meaning forwards, 0 meaning backwards
Help me homework c++
The shots file holds a list of shots (imagine some hitscan weapon in a video game like a shotgun or something). Each shot has an origin and a direction. The origin is an (x,y) coordinate, like (5,3). The direction is a slope and whether the shot is traveling along that slope or in the reverse. A slope of "Vertical" means that the shot is travelling
straight up and down.
The format is:
x_location y_location slope(either a number like 2.1 or a non-number meaning
"Vertical") forwards(1 meaning forwards, 0 meaning backwards)
0 0 0 0
0 0 0 1
0 0 Vertical 0
0 0 Squirrel 1
10 10 -1 1
-10.1 -100.01 2.1 0
The first line is a horizontal line shooting left from the origin (0,0).
The second line is a shot also travelling horizontally from the origin, but forward along the x axis instead of backwards.
The third line is shooting straight down out of the origin
The fourth line is shooting straight up out of the origin (any non-number means Vertical, not just Vertical)
The fifth line is travelling diagonally down and to the right out of (10,10)
The sixth line is travelling steeply (slope: 2.1) down and to the left out of
(-10.1,-100.01)
Things to watch out for: make sure you can handle negative slopes as well as non-numbers (like "vertical" or "squirrel" or "-") which all mean the shot is vertical.
=== Operation 2 - Print the shot data ===
For the sample shots file given above, it would print out this:
(0.00,0.00) Slope: 0.00 Backwards
(0.00,0.00) Slope: 0.00 Forwards
(0.00,0.00) Slope: Vertical Backwards
(0.00,0.00) Slope: Vertical Forwards
(10.00,10.00) Slope: -1.00 Forwards
(-10.10,-100.01) Slope: 2.10 Backwards

Assuming to be in root flash directory
Trending now
This is a popular solution!
Step by step
Solved in 10 steps with 10 images









