/* ______________________________________________________ CS 121 LESSON 6: OVERLOADED FUNCTIONS NATIVE CODE VERSION Ron Kessler Created 1/4/2017 This solution introduces overloaded functions. This allows us to use several functions of the same name but with a differenct signature. Run with CTL-F5 */ #include "stdafx.h" #include using namespace std; void DisplayWelcome (); //define the function frameworks here //this time the function is designed with 2 parameters AND a return type long add (long, long); float add (float, float); int main() { long a, b, x; float c, d, y; DisplayWelcome (); cout << "Enter two integers\n"; cin >> a >> b; cin.ignore (); x = add (a, b); cout << "\nSum of integers: " << x << "\n\n\n"; cout << "Enter two floating point numbers\n"; cin >> c >> d; y = add (c, d); cout << "\nSum of floats: " << y << "\n\n"; return 0; } //my helper functions. Make sure they are not inside main() void DisplayWelcome () { cout << ( "_____________________________________________\n" ); cout << ( "Welcome to Ron's Slightly Smarter Calculator.\n" ); cout << ( "_____________________________________________\n\n\n" ); return; //all done so return to the code that called this guy } //---both functions have the same name but different signatures long add (long x, long y) { long sum; sum = x + y; cout << "This is from the long version."; return sum; } float add (float x, float y) { float sum; sum = x + y; cout << "This is from the float version."; return sum; }