Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- //#include <stdio>
- using namespace std;
- void s_vb(sotrudnik* a, int n);
- struct sotrudnik
- {
- char fio[40];
- int tabelnomer;
- int kolchasov;
- double tarif;
- } banksystem[100];
- int main()
- {
- int n, i, j;
- cout << "vvedite kol-vo sotrudnikov: ";
- cin >> n;
- for (i = 0; i < n; i++) {
- cout << "Vvedite FIO: ";
- cin >> banksystem[i].fio;
- cout << "Vvedite tabelinii nomer: ";
- cin >> banksystem[i].tabelnomer;
- cout << "Vvedite kol-vo chasov: ";
- cin >> banksystem[i].kolchasov;
- cout << "Vvedite po4asovoi tarif: ";
- cin >> banksystem[i].tarif;
- }
- s_vb(banksystem, n);
- for (int i = 0; i < n; i++)
- {
- cout << banksystem[i].kolchasov << ' ';
- }
- system("pause");
- }
- void s_vb(sotrudnik* a, int n)
- {
- int imin, i, j, t;
- for (i = 0; i < n - 1; i++) {
- imin = i;
- for (j = i + 1; j < n; j++)
- if (a[imin].kolchasov > a[j].kolchasov) imin = j;
- if (imin != i) {
- t = a[imin].kolchasov;
- a[imin].kolchasov = a[i].kolchasov;
- a[i].kolchasov = t;
- }
- }
- }
- //void s_qs(sotrudnik st*, int n)
- //{
- // struct { int l; int r; }
- // stack[20];
- // int i, j, left, right, x, s = 0;
- // sotrudnik t;
- //
- // stack[s].l = 0;
- // stack[s].r = n - 1;
- // while (s != -1) {
- // left = stack[s].l;
- // right = stack[s].r;
- // s--;
- // while (left < right) {
- // i = left;
- // j = right;
- // x = st[(left + right) / 2].kolchasov;
- // while (i <= j) {
- // while (st[i].kolchasov < x) i++;
- // while (st[j].kolchasov > x) j--;
- // if (i <= j) {
- // t = st[i];
- // st[i] = st[j];
- // st[j] = t;
- // i++;
- // j--;
- // }
- // }
- // if ((j - left) < (right - i)) {
- // if (i < right) { s++; stack[s].l = i; stack[s].r = right; }
- // right = j;
- // }
- // else {
- // if (left < j) { s++; stack[s].l = left; stack[s].r = j; }
- // left = i;
- // }
- // }
- // }
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement