Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("BAC.in");
- ofstream fout("BAC.out");
- typedef struct
- {
- float med;
- char nume[100];
- } ELEV;
- int main()
- {
- ELEV e[100];
- int n, prom = 0;
- fin >> n;
- for (int i = 0; i < n; i++)
- {
- fin >> e[i].med >> e[i].nume;
- if (e[i].med >= 6.00)
- prom++;
- }
- for (int i = 0; i < n - 1; i++)
- for (int j = i + 1; j < n; j++)
- if (e[i].med < e[j].med)
- {
- ELEV eaux;
- eaux = e[i];
- e[i] = e[j];
- e[j] = eaux;
- }
- for (int i = 0; i < n; i++)
- fout << e[i].med << ' ' << e[i].nume << endl;
- fout << "promovati: " << prom << endl;
- fout << "respinsi: " << n - prom;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement