Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <conio.h>
- #include <iostream>
- #define SIZE 10 // размерность строки
- using namespace std;
- struct Man {
- char name[SIZE]; // фамилие и инициалы
- int vozrast;
- float doxod;
- };
- //-----------------------------------—
- Man Init_st(int i)//вводится элементы структурa
- {
- Man x;
- cout << i << " - ый человек " << endl;
- cout << "ФИО: ";
- cin >> x.name;
- cout << "Возраст: ";
- cin >> x.vozrast;
- cout << "Доход: ";
- cin >> x.doxod;
- return x;
- }
- //-----------------------------------—
- void Sort_el(int m, Man *x)//сортировка масс. подоходам
- {
- Man y; int k = 1, i = 0;
- while (i<m && k == 1) {
- k = 0;
- for (int j = 0; j<m - 1; j++) {
- if (x[j].doxod>x[j + 1].doxod)
- {
- y = x[j]; x[j] = x[j + 1]; x[j + 1] = y;
- k = 1;
- }
- }
- }
- }
- //----------------------------------—
- int Show_st(int m, Man *x) {
- for (int i = 0; i<m; i++)
- {
- cout << "------------------" << endl;
- cout << "Фамилия возраст доход" << endl;
- printf("\n % 10s % 3d %7.3f ",
- x[i].name, x[i].vozrast, x[i].doxod);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement