#include<iostream.h>
#include<string.h>
struct Students
{
char name[30];
int mark[5];
int missing;
};
double *Sr;
void Vhod(Students st[],int n)
{char x[3];
for(int i=0;i<n;i++)
{
cout<<"vavedi ime na u4enik";
cin.getline(st[i].name,29);
http://cin.getline(x,2);for(int j=0;j<5;j++)
{cout<<"vavedi 5 ocenki";
cin>>st[i].mark[j];
}
cout<<"vavedi otsastviq";
cin>>st[i].missing;
cin.getline(x,2);
}
}
void Izhod(Students st[],int n)
{
for (int i=0;i<n;i++)
{
cout<<st[i].name;
for(int j=0;j<5;j++)
cout<<st[i].mark[j]<<" ";
cout<<st[i].missing<<endl;
}
}
double Sr_uspeh(Students st[],int n)
{
double Sr=0;
for(int i=0;i<n;i++)
for(int j=0;j<5;j++)
Sr=Sr+st[i].mark[j];
return Sr/(5*n);
}
int main()
{
Students st[13];
int n,choice;
char ans='y',x[3];
cout<<"Vavedi br ue4inici";
cin>>n;
cout<<"izbor 1-vhod 2-izhod 3-sreden uspeh";
cin>>choice;
do
{
switch(choice)
{
case 1:cin.getline(x,2);Vhod(st,n);break;
case 2:Izhod(st,n);break;
case 3:cout<<"sreden uspeh"<<Sr_uspeh(st,n)<<endl;break;
//case 4:;
//case 5:;
//case 6:;
default:cout<<"nekorekten izbor";
}
cout<<"6te prodalzite li(y/n)";cin>>ans;
if(ans=='y'){cout<<endl<<"vavedi izbor na funkciq";cin>>choice;}
}
while(ans!='n');
return 0;
}