-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass27.cpp
More file actions
34 lines (30 loc) · 781 Bytes
/
class27.cpp
File metadata and controls
34 lines (30 loc) · 781 Bytes
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
#include <iostream>
using namespace std;
int findlargest(int* ptr1, int* ptr2, int* ptr3) {
if (*ptr1 >= *ptr2 && *ptr1 >= *ptr3) {
return *ptr1;
} else if (*ptr2 >= *ptr1 && *ptr2 >= *ptr3) {
return *ptr2;
} else {
return *ptr3;
}
}
int main(){
int a,b,c;
int* ptra;
int* ptrb;
int* ptrc;
cout << "Enter three integers: ";
cin >> a >> b >> c;
ptra = &a;
ptrb = &b;
ptrc = &c;
a= *ptrb;
b= *ptrc;
c= *ptra;
cout << "Value of a is: " << a << endl;
cout << "Value of b is: " << b << endl;
cout << "Value of c is: " << c << endl;
findlargest(ptra, ptrb, ptrc);
cout << "Largest value is: " << findlargest(ptra, ptrb, ptrc) << endl;
}