Question: Using the given struct below, create the two following functions do not modity the function declarations-o points if you do this): void till_train train_car train,
Using the given struct below, create the two following functions do not modity the function declarations-o points if you do this): void till_train train_car" train, FILE "p) (50 points) This function takes an array of train_carstructs and fills each struct with info from a file (sample file given below-do not HARDCODE THE FILE) (20 points. The size of the array is determined by the number of lines in the file (5 points for example, it a file has 3 fines of info, then that means the array is size 3 (hint the easiest way to do this is to read in the file a specific way). The price member in a struct should be 5.99 if the number of passengers is less than 10 (10 pointsland 10.99 otherwise (10 points. Don't forget to close the file when you are done 5 points). vold print_train(train_car trainint size) (30 points) This function prints out the info from the struts that make up the trainarray. For the sample file given the output would look like: Train car 1:25 passengers, price: $10.99 Train car 2:30 passengers, price: $10.99 Train car 3:4 passengers, price: $5.99 (10 points correctly accessing each array. 7.5 points correctly printing each passenger amount. 7.5-correctly printing each price, 5 points-overall correct match for each line in the sample run Struct: typedet struct train cart int num passengers: char size: float price: train_car: Sample File: 25-minumber of passenger size 30-1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
