Example #1
0
/*
 * Removes and returns the first bike with an owner of the given name. 
 * If such a bike is not found, the function returns a bike "None".
 */
Bike BikeShed::remove(const std::string &str, int n) {
    for (int i = 0; i < 10; ++i) {
        if (d_bike[i].getOwner() == str) {
            Bike temp = d_bike[i];
            d_bike[i] = Bike();
            return temp;
        }
    }
    return Bike();
}
Example #2
0
// removes and returns the first bike with an owner of the given name. If such a bike is not found, the function returns a bike "None"
Bike Bike_shed::remove(const string& bike) {
	for (int i = 0; i < 10; i++) {
	
		if (bikesArray[i].getOwner() == bike) {
			Bike removedBike = bikesArray[i];
			bikesArray[i] = Bike(); 
			return removedBike;
		}
	}
}