Imagine a file named part1_q14.c contains this C Code (amongst other code): 1 #include 2 3 struct driver { 4 c

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Imagine a file named part1_q14.c contains this C Code (amongst other code): 1 #include 2 3 struct driver { 4 c

Post by answerhappygod »

Imagine A File Named Part1 Q14 C Contains This C Code Amongst Other Code 1 Include Stdio H 2 3 Struct Driver 4 C 1
Imagine A File Named Part1 Q14 C Contains This C Code Amongst Other Code 1 Include Stdio H 2 3 Struct Driver 4 C 1 (51.89 KiB) Viewed 40 times
Imagine a file named part1_q14.c contains this C Code (amongst other code): 1 #include <stdio.h> 2 3 struct driver { 4 char code [3]; 5 double points; 6 struct driver *followed_by; 7 }; 8 9 // Inserts a node at the head of the list, and returns the new head. 10 struct driver *insert_head (struct driver *standings, char code [3], double points); 11 12 int main(void) { 13 struct driver *standings = NULL; 14 15 16 standings = insert_head (standings, "NOR", 160.0); standings = insert_head(standings, "SAI", 164.5); standings = insert_head(standings, "PER", 190.0); standings = insert_head (standings, "BOT", 226.0); standings = insert_head(standings, "HAM", 387.5); standings = insert_head(standings, "VER", 395.5); 17 18 19 20 21 struct driver *current = standings; 22 23 while (current->followed by != NULL) { 24 if (current->points - current->followed_by->points < 10) { printf("%s is less than 10 points behind %s.\n", [SECRET]); 25 26 } 27 current current->followed_by; 28 } 29 30 return NULL; 31 } part1 q14.c is compiled with dcc on a CSE machine like this: st 01 =
This code sets up and prints out the leaderboard for a driving competition. Your job is to replace [SECRET] with code that will print out a list of drivers who are within 10 points of each other. For the given input values, you should print: HAM is less than 10 points behind VER. NOR is less than 10 points behind SAI. For instance, if you think the line of code should read current != NULL, your answer would be current != NULL.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply