#include <stdio.h>
#include <stdlib.h>
#define LICZBA_OCEN 5
float oceny[LICZBA_OCEN] = { 3, 3.5, 4.5, 5, 5 };
void
wyswietl (Student * student)
{
printf ("%s\n", (*student).imie_nazwisko);
int i;
for (i = 0; i < LICZBA_OCEN; i++)
{
printf ("%.1f\n", (*student).ocena[i]);
}
float srednia (Student * student)
{
float suma = 0;
int i;
for (i = 0; i < LICZBA_OCEN; ++i)
{
suma = suma + (*student).oceny[i];
}
return /LICZBA_OCEN;
}
typedef struct
{
char imie_nazwisko[50];
float oceny[LICZBA_OCEN];
}
Student s;
stropy (s.imie_nazwisko, "Novikov Oleksandr");
int main ()
{
s.oceny[0] = 4.5;
s.oceny[1] = 5;
s.oceny[2] = 3.5;
s.oceny[3] = 3;
s.oceny[4] = 5;
wyswietl (&s);
printf ("Srednia: %.2f", srednia (&s));
}