this is sorta my last ditch effort here.. I have been bashing my head on the wall several days going through this.. (yes I'm rather new to C++ coding and this is what I have to do)
- have 4 files w/ information on cars (each file has 399 lines worth, x and y values)
ex. 0.967369 -19643.556725
- prompt user to pick vehicle and call the corresponding file, writing info to kw400 variable
- make sure no error opening file
- Divide Kw400 by 80000 and store the result back in Kw400
- Some of the guidance of formulas are provided..
WOW.. this doesn't feel like an intro course any longer. Just a little direction of guidance would be nice. This is supposed to be extremely basic. making user choose which model, pretty much calling a file, verify, store values in a string (don't think an array). and run a computation on results, display.
Code:int carNo; // The number of the car selected cout << "Kw400 Crush-Work Stiffness Metric\n\n" << "1. 2007 Honda Civic\n" << "2. 2005 Chevy Cobalt\n" << "3. 2007 Toyota Camry\n" << "4. 2006 Ford Fusion\n" << "Choose a vehicle (1, 2, 3, 4): "; cin >> carNo; // Call the calcKw400 with one of the following filenames: // honda_civic_2007.txt // chevy_cobalt_2005.txt // toyota_camry_2007.txt // ford_fusion_2006.txt // Store the result in the kw400 variable // Display the output with two numbers after the decimal point system("pause"); } /* * Function: calcKw400 * Purpose: This is function calculates the Kw400 Crush-Work * Stiffness based on the values stored in the file * filename[] * Parameters: filename: a string with the name of the file to open * Returns: the calculated Kw400 value */ double calcKw400(char filename[]) { double Kw400 = 0; double X = 0, Y = 0; double lastX = 0; ifstream inFile; // Open the file // Check to make sure that there was no error opening the file // While there is data to read in the file... // Divide Kw400 by 80000 and store the result back in Kw400 // Close the file return Kw400;