#include #include #include "RankT.h" #include "NameT.h" #include "PrisonerT.h" using namespace std; PrisonerT GetPrisoner(){ PrisonerT returnValue; string tmp; cout << "Please enter the prisoner's name:" << endl; returnValue.name = ReadName(); cout << endl; cout << "Enter the prinsoner's rank: => "; cin >> tmp; returnValue.rank = GetRankTFromString(tmp); cout << endl; cout>> "Enter the prisoner's serial number =>"; cin >>returnValue.serialNumber; return returnValue; } void PrintPrisoner(PrionerT prisoner){ cout << "Name: " << NameString(prisoner.name) << endl; cout << "Rank: " << PrintRank(prisoner.rank) << endl; cout << "Serial Number " << prisoner.serialNumber << endl; } // return -1 if a is less, 0 if they are the same and 1 if b is less. int ComparePrisoner(PrisonerT a, PrisonerT b){ int returnValue = 0; if (a.rank == b.rank) { if (a.serialNumber == b.serialNumber) { returnValue = CompareNames(a.name, b.name); } else if (a.serialNumber < b.serialNumber) { returnValue = -1; } else { returnValue = 1; } } else if (a.rank < b.rank) { returnValue = -1; } else { returnValue = 1; } return returnValue; }