-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunzione_max.cpp
More file actions
55 lines (45 loc) · 1.35 KB
/
funzione_max.cpp
File metadata and controls
55 lines (45 loc) · 1.35 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
#include <iostream>
using namespace std;
void hello()
{
cout<<"***********************************************************************************"<<endl;
cout<<"-------------------------------- Hello World!!! ---------------------------------"<<endl;
cout<<"***********************************************************************************"<<endl;
}
void stampa_con_cornice(string msg)
{
cout<<endl<<"***********************************************************************************"<<endl;
cout<<" "<<msg<<" ";
cout<<endl<<"***********************************************************************************"<<endl;
}
int max(int n1, int n2)
{
if(n1>n2)
{
return n1;
}
else
{
return n2;
}
}
int main()
{
hello();
stampa_con_cornice("Questo programma calcola il max tra tre numeri interi usando la funzione max!!!");
int a, b, c, m;
cout<<"Inserisci il primo numero: ";
cin>>a;
cout<<"Inserisci il secondo numero: ";
cin>>b;
cout<<"Inserisci il terzo numero: ";
cin>>c;
m = max(a, b);
m = max(m, c);
string mymsg = "il max tra " + to_string(a) + ", " + to_string(b) + ", " + to_string(c) + " e': " + to_string(m);
stampa_con_cornice(mymsg);
string nome;
cout<<"inserisci il tuo nome: ";
cin>>nome;
stampa_con_cornice("ciao " + nome);
}