-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinMaxReddito.cpp
More file actions
39 lines (38 loc) · 798 Bytes
/
MinMaxReddito.cpp
File metadata and controls
39 lines (38 loc) · 798 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
35
36
37
38
39
#include <iostream>
#include <string>
using namespace std;
main()
{
int mb=0,ma=0,i=1,n=0,rd=0;
string nt,na,nb;
cout<<"Inserisci numero clienti: ";
cin>>n;
while(i<=n)
{
cout<<"Inserisci nome cliente "<<i<<": ";
cin>>nt;
cout<<"Inserisci reddito cliente "<<i<<": ";
cin>>rd;
if(i=1)
{
ma=rd;
na=nt;
mb=rd;
nb=nt;
}
if(rd>ma)
{
ma=rd;
na=nt;
}
if(rd<mb)
{
mb=rd;
nb=nt;
}
i++;
}
cout<<"- - - - - - - - - - - - -"<<endl;
cout<<"Reddito più alto: "<<ma<<" Appartenente a: "<<na<<endl;
cout<<"Reddito più basso: "<<mb<<" Appartenente a: "<<nb<<endl;
}