Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //Overloading f1 three ways
- int f1(int a);
- double f1(double a);
- long f1(long a);
- int main()
- {
- cout << f1();
- system ("pause");
- return 0;
- }
- //f1 for integer
- int f1(int a)
- {
- cout << "Please enter a number: ";
- cin >> a;
- return a;
- }
- // f1 for double
- double f1(double a)
- {
- cout << "Please enter a number: ";
- cin >> a;
- return a;
- }
- //f1 for long
- long f1(long a)
- {
- cout << "Please enter a number: ";
- cin >> a;
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement