Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <string>
- #define BUF 40
- using namespace std;
- struct people {
- wchar_t fio[BUF];
- int number_grup;
- double progress_bal;
- friend bool operator<(const people & _a, const people & _b) { return _a.fio < _b.fio; };
- };
- void in_students (people *, size_t);
- void out_students (people *, size_t);
- void ru();
- int main () {
- ru();
- const size_t size = 2;
- people students[size];
- wcout << setw(30) << L"Ввод студентов\n\n";
- in_students(students, size);
- cout << setw(59) << setfill('_') << ' ' << endl << endl;
- sort(students, students + size);
- out_students(students, size);
- cin.get(); cin.get();
- return 0;
- }
- void in_students(people * _st , size_t _size) {
- if (_st)
- for (size_t n = 0; n < _size; n++) {
- wcout << L"\tСтудент " << n + 1 << ':';
- fflush(stdin);
- wcout << L"\n Ф.И.О. -> "; wcin.getline(_st[n].fio, BUF);
- wcout << L" Номер группы -> "; cin>>_st[n].number_grup;
- wcout << L" Успеваемость -> "; cin>>_st[n].progress_bal;
- cout << endl;
- }
- }
- void out_students(people * _st , size_t _size) {
- if (_st)
- for (size_t n = 0; n < _size; n++) {
- wcout << L"\tСтудент " << n + 1 << ':';
- wcout << L"\n Ф.И.О.: "; wcout << _st[n].fio;
- wcout << L"\n Номер группы: "; cout << _st[n].number_grup;
- wcout << L"\n Успеваемость: "; cout << _st[n].progress_bal;
- cout << endl;
- }
- }
- void ru() {
- wcout.imbue(locale("rus_rus.866"));
- wcin.imbue(locale("rus_rus.866"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement