Assign agepointer with the address of the older age. if the ages are the same, then assign agepointer with nullptr.
ex: if the input is 12.5 39.0, then the output is:
26.5 is the younger age.
If the ages are the same, then assign agePointer with nullptr.
===
#include
#include
using namespace std;
int main() {
double age1;
double age2;
double* agePointer;
cin >> age1;
cin >> age2;
/* Your code goes here */
if (agePointer == nullptr) {
cout << "The ages are the same." << endl;
}
else {
cout << fixed << setprecision(1) << *agePointer << " is the younger age." << endl;
}
return 0;
}