- struct Student
- {
- string name;
- string grupa;
- int year;
- } ;
- int Function(struct Student **);
- int main()
- {
- struct Student stud1 = {"Michel","AБ-91",2001};
- struct Student stud2 = {"Alex","ОБ-92з",2002};
- struct Student stud3 = {"Iren","rpbi-82",2000};
- struct Student stud4 = {"Ivan","ikt-802",1999};
- Student *stud[4]= {&stud1,&stud2,&stud3,&stud4};
- double S[4];
- int k=Function(stud);
- cout<<stud[k]->name<<" "<<stud[k]->grupa<<" "<<stud[k]->year<<endl;
- return 0;
- }
- int Function(struct Student **stud)
- { int m=stud[0]->year; int k=0;
- for(int i=0; i<4; i++)
- if (stud[i]->year>m) m=stud[i]->year, k=i;
- return k;
- }
[text] 1
Viewer
Editor
You can edit this paste and save as new: