Untitled
raw download clone
CPP
views 33
,
size 566 b
#include <iostream>
#include <cstring>
using namespace std;

struct elev
{
    char nume[51];
    char prenume[51];
    int nota1, nota2;
    float medie;
}v[101];

int main ()
{
    int n, N, Ma;
    cin >> n >> N >> Ma;

    for(int i = 1; i <= n; i++)
    {
        cin >> v[i].nume >> v[i].prenume >> v[i].nota1 >> v[i].nota2;
        v[i].medie = (v[i].nota1 + v[i].nota2) / 2.;
    }

    for(int i = 1; i < n; i++)
        for(int j = i + 1; j <= n; j++)
            if(v[i].medie < v[j].medie)
                swap(v[i], v[j]);
}
close fullscreen
Login or Register to edit or fork this paste. It's free.