Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
|
|
// write below the prototype of readfrom // write below the prototype of sort // write below the prototype of search
[70pts] Write a program hw.cpp that reads in a file like cardata.txt and stores for each car the "tag", which is a character identifying the car, and the location (in miles relative to our current location) and velocity (in mph) of the car. The program will then print the locations of the cars initially, and after 1, 2, ..., 8 hours. So for the example file cardata.txt, the run would look like this:
~/$ ./hw
cardata.txt
hour 0 [A:-120][X:20.5][C:7][M:-5.5]
hour 1 [A:-97.5][X:6.5][C:27][M:-14]
hour 2 [A:-75][X:-7.5][C:47][M:-22.5]
hour 3 [A:-52.5][X:-21.5][C:67][M:-31]
hour 4 [A:-30][X:-35.5][C:87][M:-39.5]
hour 5 [A:-7.5][X:-49.5][C:107][M:-48]
hour 6 [A:15][X:-63.5][C:127][M:-56.5]
hour 7 [A:37.5][X:-77.5][C:147][M:-65]
hour 8 [A:60][X:-91.5][C:167][M:-73.5]
Obviously, given today’s topic, I'm expecting you to use structs for this!
~/bin/submit -c=IC210 -p=hw26 hw.cpp