#include "Header.h" //13b void getInput(int valuesList[], int& VALUE) { while (valuesList[VALUE] != '\0') { VALUE++; cout << "\nEnter value #" << VALUE + 1 << ". Enter 0 to stop input and display median.\n"; cin >> valuesList[VALUE]; if (valuesList[VALUE] == 0) { valuesList[VALUE] = '\0'; } } VALUE = 0; } void calculateLength(int valuesList[], int& VALUE, int& valuesTotal) { while (valuesList[VALUE] != '\0') { valuesTotal++; VALUE++; } VALUE = 0; } void lowestToHighest(int valuesList[], int& VALUE, int& valuesTotal, int reorderList[], int& reorderTotal) { while (reorderTotal < valuesTotal) { int mostBig = 0; int mostBigPos = 0; VALUE = 0; while (VALUE < valuesTotal) { if (valuesList[VALUE] > mostBig) { mostBig = valuesList[VALUE]; mostBigPos = VALUE; } VALUE++; } reorderList[((valuesTotal)-reorderTotal) - 1] = mostBig; valuesList[mostBigPos] = 0; reorderTotal++; } VALUE = 0; while (VALUE < valuesTotal) { valuesList[VALUE] = reorderList[VALUE]; VALUE++; } VALUE = 0; } void calculateMedian(int valuesList[], int& VALUE, int& valuesTotal) { if (valuesTotal % 2 == 0) { int mid1 = 0; int mid2 = 0; while (VALUE <= (valuesTotal / 2)) { if (VALUE == ((valuesTotal / 2) - 1)) { mid1 = valuesList[VALUE]; } if (VALUE == ((valuesTotal / 2))) { mid2 = valuesList[VALUE]; } VALUE++; } cout << "\nThe median of your input is: " << (mid1 + mid2) / 2 << endl; } else { int mid = 0; VALUE = ((valuesTotal / 2)); mid = valuesList[VALUE]; cout << "\nThe median of your input is: " << mid << endl; } } //13c int checkFile() { ifstream inFile; inFile.open("employee data.txt"); if (!inFile) { return 0; } else { return 1; } } void createFile() { ofstream newFile; newFile.open("employee data.txt"); newFile.close(); cout << "No file detected. " << "A new file has been created. " << "Please input data into the file and restart the program.\n"; } void formatData() { int wage[100] = {}; string text; //if the file is detected cout << "File detected. Formatting data...\n" << endl; ifstream readFile; readFile.open("employee data.txt"); while (readFile) { getline(readFile, text); cout << text << endl; } cout << "\nAll data has been read. The program will now end." << endl; }