// Practice // add code where indicated to finish the program. #include #include #include using namespace std; bool importData(double[], const int, int &, ifstream &); // ADD - 'exportData' function prototype (do after you have written definition) // ADD -'subtractFive' function prototype(do after you have written definition) int main() { int count; // count holds the number of items put into the array. // ADD - create a constant integer of 100 named 'SIZE' // ADD - create an array of doubles with a size of 'SIZE' named 'jedi' ifstream fin; fin.open("input_file.txt"); ofstream fout; fout.open("output_file.txt"); // Import data - if data fails to be imported exit program if( importData(jedi, SIZE, count, fin) ) return -1; // ADD - 'subtractFive' function call here (do after writing definition) // ADD - 'exportData' function call here (do after writing definition) fin.close(); fout.close(); return 0; } // imports data from file. returns true if operation fails, false if succeeds bool importData(double J [], const int SIZE, int & cnt, ifstream & fin) // { if(!fin){ cout << "ERROR - File failed to open." << endl; return 1; } cnt = 0; while (fin >> J[cnt] && cnt < SIZE) cnt++; return 0; } // ADD - write a function called 'subtractFive' which subtracts 5 from each // of the elements in the 'jedi' array. Implement in any way you choose. // ADD - write a function called 'exportData' which exports the contents // of array 'jedi' to output.txt. Each element should be on it's own line. // Implement in any way you choose.