Advertisement
jbonanno

Overloading Function Example

Nov 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6.  // This prints the string passed as an argument.
  7. void display(char []);  //
  8. void display(char [], char [], char[]);
  9.  
  10. int main()
  11. {
  12.    char one[] = "Apple";
  13.    char two[] = "Banana";
  14.    char three[] = "Pear";
  15.  
  16.    display(one);
  17.    display(one, two, three);
  18.  
  19.    return 0;
  20. }
  21.  
  22. void display(char a[])
  23. {
  24.    cout << a << endl;
  25. }
  26.  
  27. void display(char a[], char b[], char c[])
  28. {
  29.    cout << a << endl << b << endl << c << endl;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement