Hello, this program is supposed to take the user's "desired car" input (model,mileage and price) and compare it to cars in an inventory file (current_inventory). I need to do this using two functions: get_next_auto(to take the next car from the inventory until the end of the file) and compare_auto(compare the inventory car to the user's requirements) at the end the program should read out how many cars from the inventory met the user's requirements. So far this program compiles, but after typing in the user's model, mileage and price it doesn't do anything and seems to be going through an indefinite loop. Will someone please help me figure out what I am doing wrong? Thanks a lot I really appreciate it.
It might help you to figure it out if you did not use the same names for different items. i.e. you have a function called compare_auto and then you declare a boolean called compare_auto within get_next_auto, you then reference it again in the while loop in the same function... not really easy to determine what you want to do.
This is probably what is confusing you with the int num_acceptable, it is not a global variable, so the value is not known between functions... you can place it outside the functions at the top of the file or pass the value as part of the function return.
I am trying to make my function get_next_auto to run the function compare_auto until the end of file how do i do this? what should i change can you please show me?