-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesercizio_funzioni_3.cpp
More file actions
71 lines (52 loc) · 1.05 KB
/
esercizio_funzioni_3.cpp
File metadata and controls
71 lines (52 loc) · 1.05 KB
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
66
67
68
69
70
71
#include <iostream>
#include <cmath>
using namespace std;
float min(float n1, float n2) {
cout<<"min con float"<<endl;
if (n1>n2) {
return n2;
}
return n1;
}
int min(int n1, int n2) {
cout<<"min con int"<<endl;
if (n1>n2) {
return n2;
}
return n1;
}
// int floor(float a) {
// return (int)a;
// }
// int ceil(float a) {
// return 1+(int)a;
// }
// int round(float a) {
// cout<<"ROUND";
// int pint;
// float pfloat;
// pint=floor(a);
// pfloat=a-pint;
// if (pfloat>0.5) {
// return ceil(a);
// }
// return floor(a);
// }
float max(float n1, float n2) {
if (n1>n2) {
return n1;
}
return n2;
}
int main() {
float a,b,c,minimo,massimo;
cout<<"inserisci 3 numeri"<<endl;
cin>>a>>b>>c;
minimo=min(min(a,b),c);
massimo=max(max(a,b),c);
cout<<"il minimo e' "<<minimo<<endl;
cout<<"il massimo e' "<<massimo<<endl;
cout<<"floor di "<<a<<" e' "<<floor(a)<<endl;
cout<<"round di "<<a<<" e' "<<round(a);
return 0;
}