void HousingRegister::printBythePrice(string *array, float max)const { int index = 0; for (int i = 0; i <nrOfHouses; i++) { if (housing[i]->getRent() <= max) { array[index] = housing[i]->toString(); index++; } } } //mainfunc void printBythePrice(const HousingRegister &house){ float max; string *arr = new string[house.getnrOfHouses()]; cout << "Enter the price: "; cin >> max; house.printBythePrice(arr, max); for (int i = 0; i < house.getnrOfHouses(); i++) { cout << arr[i]; } delete[] arr; }
std::vector
house.getnrOfHouses()==index;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)