Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1. Информация по N рабочим завода задается строкой следующего вида: фамилия, средний возраст, специальность, средний оклад. Ввести информацию по рабочим. Напечатать имена рабочих, чей средний возраст выше 35 лет.
- #include <iostream>
- #include <fstream>
- using namespace std;
- struct Point
- {
- int num;
- char fam[256];
- int age;
- char spec[256];
- int okl;
- };
- void input (Point *A,int n)
- {
- for (int i=0;i<n;i++)
- {
- cin>>A[i].num >> A[i].fam >>A[i].age>>A[i].spec>>A[i].okl;
- }
- }
- void highAge (Point* A,int n)
- {
- for (int i=0;i<n;i++)
- {
- if (A[i].age > 35 )
- cout<<A[i].fam<<" ";
- }
- }
- void output(Point* A, int n)
- {
- for (int i = 0; i < n; i++)
- {
- cout << A[i].num<<" "<< A[i].age << " " << A[i].okl <<" "<<A[i].fam<<" "<<A[i].spec << endl;
- }
- cout<<endl;
- }
- int main ()
- {
- int n;
- cin>>n;
- Point* P = new Point[n];
- input(P, n);
- cout<<endl;
- output(P, n);
- cout<<endl;
- highAge(P, n);
- cout<<endl;
- }
Add Comment
Please, Sign In to add comment