Advertisement
Guest User

Untitled

a guest
Feb 27th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. //Overloading f1 three ways
  5.  
  6. int f1(int a);
  7. double f1(double a);
  8. long f1(long a);
  9.  
  10. int main()
  11. {
  12. cout << f1();
  13. system ("pause");
  14.  
  15. return 0;
  16. }
  17.  
  18. //f1 for integer
  19. int f1(int a)
  20. {
  21. cout << "Please enter a number: ";
  22. cin >> a;
  23. return a;
  24. }
  25.  
  26. // f1 for double
  27. double f1(double a)
  28. {
  29. cout << "Please enter a number: ";
  30. cin >> a;
  31. return a;
  32. }
  33.  
  34. //f1 for long
  35. long f1(long a)
  36. {
  37. cout << "Please enter a number: ";
  38. cin >> a;
  39. return a;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement