hello all
im having as the title would suggest a runtime crash in my program cant quite figure out why hits some ware around enter tenant name. line 53
void ComplexInterface::editUnit(){
bool test = false;
do {
int unitToEdit;
cout << "choose a Unit to edit " << endl;
for (int i = 0; i < numberOfUnits; ++i) {
cout << i+1 << " " <<complexList[i].getTenantName();
}
cout << "enter " << numberOfUnits+1 << " to add a new unit";
cout << "enter 0 to go back" << endl;
cout << "Answer: ";
cin >> unitToEdit;
if (unitToEdit == 0) {
test = true;
}
else if (unitToEdit > 0 && unitToEdit <= numberOfUnits) {
editUnit(unitToEdit);
}
else if (unitToEdit == numberOfUnits+1) {
int unitNumber, unitSiz, aptNumRepairs;
double balDue;
string tenantName;
cout << "enter the unit Number: ";
cin >> unitNumber;
cout << "enter the unit size: ";
cin >> unitSiz;
cout << "enter the number of repairs: ";
cin >> aptNumRepairs;
int repairArray[aptNumRepairs];
for (int i = 0; i < aptNumRepairs; ++i) {
int boolCheck;
string repairName, repairInfo;
bool done;
cout << "enter repair Name: ";
getline(cin,repairName);
getline(cin,repairName);
cout << "enter repair Info: ";
getline(cin,repairInfo);
cout << "is the repair compleate 1:Yes 2:No";
cin >> boolCheck;
if (boolCheck == 1) {
done = true;
}
else if (boolCheck = false) {
done = false;
}
Repairs tempRepair(repairName,numberOfRepairs+1,repairInfo,done);
repairsList.push_back(tempRepair);
repairArray[i]=numberOfRepairs+1;
numberOfRepairs++;
}
cout << "enter name of Tenant: ";
getline(cin,tenantName);
int *repPtr = repairArray;
Tenants newTenant(unitNumber,balDue,unitSiz,aptNumRepairs,tenantName,repPtr);
}
} while (!test);
}
full project is in the zip and im using eclipse with g++
thanks for any help.