aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab9/CST116F2021-Lab9.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116F2021-Lab9/CST116F2021-Lab9.cpp')
-rw-r--r--CST116F2021-Lab9/CST116F2021-Lab9.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/CST116F2021-Lab9/CST116F2021-Lab9.cpp b/CST116F2021-Lab9/CST116F2021-Lab9.cpp
index 1372506..87908c8 100644
--- a/CST116F2021-Lab9/CST116F2021-Lab9.cpp
+++ b/CST116F2021-Lab9/CST116F2021-Lab9.cpp
@@ -55,7 +55,7 @@ int main(void)
{
cout << data[idx] << " ";
}
-
+
cout << endl;
return (0);
@@ -161,7 +161,7 @@ int main(void)
}
populateMetaData(metaData, mainData, numEntries); //Make fist map
- bubiSortIndex(metaData[0], metaData[1], numEntries);
+ bubiSortIndex(metaData[0], metaData[1], numEntries);
cout << "Personnel manifest explorer MK1" << endl;
@@ -275,8 +275,7 @@ int main(void)
break;
}
- }
- while (menuChoice != 5);
+ } while (menuChoice != 5);
menuChoice = -1;
@@ -284,19 +283,19 @@ int main(void)
case(4): //Displays all available information
+ cout << left;
+ cout << endl << setw(25) << "First name" << setw(25) << "Last name" << setw(25) << "Phone number" << setw(25) << "Date of birth" << endl;
+ for (int idx = 0; idx < (25 * 4); idx++)
+ {
+ cout << char(205);
+ }
cout << endl;
for (int idx = 0; idx <= numEntries; idx++)
{
- for (int idy = 0; idy <= numEntries; idy++)
- {
- if (metaData[0][idy] == idx)
- {
- displayEntry(mainData, idy);
+ displayEntry(mainData, metaData[0][idx]);
- cout << endl;
- }
- }
+ cout << endl;
}
cout << endl;
@@ -307,8 +306,7 @@ int main(void)
populateMetaData(metaData, mainData, numEntries); //Regenerate map
bubiSortIndex(metaData[0], metaData[1], numEntries);
- }
- while (menuChoice != 5);
+ } while (menuChoice != 5);
return (0);
}
@@ -349,14 +347,14 @@ void bubiSortIndex(int map[MV_3], int dataArray[MV_3], int len)
}
}
-//Swaps the dataArray using a map for a specified number of entries (unused)
-void swapDataArray(string dataArray[4][MV_3], int meta[MV_3], int &entries)
+//Swaps the dataArray using a map for a specified number of entries (UNUSED)
+void swapDataArray(string dataArray[4][MV_3], int meta[MV_3], int& entries)
{
string swapValue[4];
for (int idx = 0; idx < entries; idx++)
{
- if(meta[idx] > 0)
+ if (meta[idx] > 0)
{
for (int idy = 0; idy < 4; idy++)
{
@@ -381,7 +379,7 @@ void populateMetaData(int meta[2][MV_3], string dataAray[4][MV_3], int entries)
}
//Opens a file at the provied path, the enters its contents into an array. Returns false if there is an I/O error.
-bool populateDataArray(string fileLoc, string dataArray[4][MV_3], int &numEntries)
+bool populateDataArray(string fileLoc, string dataArray[4][MV_3], int& numEntries)
{
ifstream inputFile;
bool isFileOpen = false;
@@ -426,7 +424,7 @@ bool getInt(int& innum)
if (!cin.good())
{
- cin.clear();
+ cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
valid = false;