#include <iostream>
using namespace std;
template<typename A, typename B>
auto pairSum(A a, B b) -> decltype(a+b) {
return a + b;
}
int main() {
double a, b;
cin >> a >> b;
cout << pairSum(a, b) << "\n";
return 0;
}
Solution Details
👉 In simple words:
This function just adds two numbers, no matter if one is an int and the other is a float — it figures out the correct return type automatically.
Significance for Embedded Developers
Input
5 7
Expected Output
12