-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample1.cpp
65 lines (53 loc) · 1.09 KB
/
Example1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file Example1.cpp
*
* @brief Calling overloaded function test() with different argument/s.
*
* @author Saif Ullah Ijaz
*
*/
#include <iostream>
using namespace std;
// FUNCTION PROTOTYPE (DECLARATION)
/** function that tests an integer value.
*
* @param var The integer number to be tested.
*
* @return void.
*/
void test(int);
/**
# @overload void test(float);
*/
void test(float);
/**
# @overload void test(int, float);
*/
void test(int, float);
// function main begins program execution
int main() {
int a = 5;
float b = 5.5;
test(a);
test(b);
test(a, b);
system("pause");
return 0;
}
// end main
// FUNCTION DEFINITION
// takes integer as input
void test(int var) {
cout << "Integer number: " << var << endl;
}
// end function test
// takes float as input
void test(float var) {
cout << "Float number: " << var << endl;
}
// end function test
// takes integer & float as input
void test(int var1, float var2) {
cout << "Integer number: " << var1; cout << " And float number: " << var2 << endl;
}
// end function test