lundi 30 mai 2016

Empty places at the end of the arrays c ++ [on hold]

enter code here//handlerfunction void HousingRegister::printBythePrice(string *array, float max)const { int index = 0; for (int i = 0; i getRent() <= max) { array[index] = housing[i]->toString(); index++; } } }//mainfunction 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; //Array delete

}

Aucun commentaire:

Enregistrer un commentaire