#include #include #include using namespace std; struct CarInfo { // Structure containing car details. double fuelCapacity; // in gallons double fuelEfficiency; // in miles per gallon }; void calculateRange(CarInfo *pCar); int main() { CarInfo myCar {15.0, 30.0}; // Fuel capacity: 15 gallons, Efficiency: 30 mpg calculateRange(&myCar); // Pass the address of the structure to the function. return EXIT_SUCCESS; } void calculateRange(CarInfo *pCar) { // pCar->member is the same as (*pCar).member double maxDistance = pCar->fuelCapacity * pCar->fuelEfficiency; cout << "With a fuel capacity of " << pCar->fuelCapacity << " gallons and a fuel efficiency of " << pCar->fuelEfficiency << " miles per gallon, you can travel up to " << maxDistance << " miles.\n"; } }