#include using namespace std; void howManyPets(string petType, int &numPets){ int temp =0; cout << "How many " << petType << " do you have?" << endl; cin >> temp; // if we were doing error handling we'd put that here numPets = numPets + temp; } int main(){ int totalPets = 0; howManyPets("cats", totalPets); howManyPets("dogs", totalPets); howManyPets("chickens", totalPets); cout << "you have " << totalPets << " pets" << endl; return 0; }