Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

CSC112 Spring 2016 Examples

2370 views
1
#include <iostream>
2
3
using namespace std;
4
5
//overloaded function prototypes
6
void print(int x);
7
void print(double x);
8
void print(char c);
9
10
int main() {
11
12
//overloaded calls
13
print(5);
14
print(5.0);
15
print('a');
16
17
return 0;
18
}
19
20
21
void
22
print(int x) {
23
cout << "INTEGER: " << x << endl;
24
}
25
26
void
27
print(double x) {
28
cout << "DOUBLE: " << x << endl;
29
}
30
31
32
void
33
print(char c) {
34
cout << "CHARACTER: " << c << endl;
35
}
36
37