Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main()
- {
- int voto,gins=0,ins=0,suff=0,disc=0,ott=0,nstud=0;
- float percgins,percins,percsuff,percdisc,percott,somma=0,media=0, nins;
- cout<<"Inserire il numero degli alunni\n";
- cin >> nins;
- cout<<"Inserire ora i voti degli alunni\n\n";
- while(nins>0){
- cout<<"Inserire il voto di un alunno: ";
- cin>>voto;
- switch(voto)
- {
- case 0:
- somma--;
- break;
- case 1:
- case 2:
- case 3:
- case 4:
- gins++;
- break;
- case 5:
- ins++;
- break;
- case 6:
- suff++;
- break;
- case 7:
- case 8:
- disc++;
- break;
- case 9:
- case 10:
- ott++;
- break;
- }
- media=media+voto;
- somma++;nins--;
- };
- percgins=(gins/somma)*100;
- percins=(ins/somma)*100;
- percsuff=(suff/somma)*100;
- percdisc=(disc/somma)*100;
- percott=(ott/somma)*100;
- media=media/somma;
- cout<<"Gravemente insufficiente: " <<gins <<" persone con una percentuale sul totale del " <<percgins <<"%" <<endl;
- cout<<"Insufficiente: " <<ins <<" persone con una percentuale sul totale del " <<percins <<"%" <<endl;
- cout<<"Sufficiente: " <<suff <<" persone con una percentuale sul totale del " <<percsuff <<"%" <<endl;
- cout<<"Discreto: " <<disc <<" persone con una percentuale sul totale del " <<percdisc <<"%" <<endl;
- cout<<"Ottimo: " <<ott <<" persone con una percentuale sul totale del " <<percott <<"%" <<endl;
- cout<<"La media dei voti e': " <<media << endl;
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement