-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgestione_livello_linguistico.cpp
More file actions
61 lines (55 loc) · 1.09 KB
/
gestione_livello_linguistico.cpp
File metadata and controls
61 lines (55 loc) · 1.09 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
#include <iostream>
#include "studente.h"
using namespace std;
const int N = 30;
int n_stud = 0;
studente studenti[N];
void ricerca()
{
for(int i = 0; i < n_stud; i++)
{
studente s1 = studenti[i];
for(int j = 0; j < n_stud; j++)
{
studente s2 = studenti[j];
if((s1.c.a<s2.c.a)&&((s1.ll.c>s2.ll.c)||
((s1.ll.c==s2.ll.c)&&(s1.ll.i>s2.ll.i))))
{
cout<<s1.matricola<<endl;
}
}
}
}
void inserimento()
{
for(int i = 0; i < 5; i++)
{
studente s;
s.matricola = rand()%100 + 1;
s.c.a = rand()%5 + 1;
s.c.s = rand()%10 + 65;
s.ll.c = rand()%3 + 65;
s.ll.i = rand()%3 + 1;
studenti[n_stud] = s;
n_stud++;
}
}
void stampa()
{
for(int i = 0; i < n_stud; i++)
{
studente s = studenti[i];
cout<<s.matricola<<" ";
cout<<s.c.a;
cout<<s.c.s<<" ";
cout<<s.ll.c;
cout<<s.ll.i<<endl;
}
}
int main()
{
srand(time(NULL));
inserimento();
stampa();
ricerca();
}