Advertisement
Guest User

Projekt

a guest
Dec 11th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.21 KB | None | 0 0
  1. #define _CRT_SECURE_NO_DEPRECATE
  2. #define CRT_NO_SECURE_WARNINGS
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. #define MAXNAME 20
  8. #define MAX 5
  9. typedef struct student
  10. {
  11.     char imie[ MAXNAME ];
  12.     char nazwisko[ MAXNAME ];
  13.     float oceny[ MAX ];
  14.     int nr_dz;
  15.     float srednia;
  16. }student;
  17.  
  18. void dodaj_oceny( student &student );
  19. void wyswietl_oceny( student student );
  20.  
  21.  
  22. int main( int argc, char *argv[] )
  23. {
  24.     struct student student1;
  25.  
  26.  
  27.     printf( "Podaj imie studenta\n" );
  28.     scanf( "%s", &student1.imie );
  29.     printf( "Podaj nazwisko studenta\n" );
  30.     scanf( "%s", &student1.nazwisko );
  31.     printf( "Podaj numer dziennika studenta\n" );
  32.     scanf( "%d", &student1.nr_dz );
  33.  
  34.     printf( "Wprowadzono nastepujace dane studenta:\n" );
  35.     printf( "Imie: %s\n Nazwisko: %s\n Numer dziennika: %d\n", student1.imie, student1.nazwisko, student1.nr_dz );
  36.  
  37.     dodaj_oceny( student1 );
  38.     wyswietl_oceny( student1 );
  39.  
  40.     system( "PAUSE" );
  41.     return 0;
  42. }
  43.  
  44.  
  45. void dodaj_oceny( student &example )
  46. {
  47.     printf( "Podaj 5 ocen studenta\n" );
  48.  
  49.     for( int i = 0; i < MAX; i++ )
  50.     {
  51.         scanf( "%f", &example.oceny[ i ] );
  52.     }
  53. }
  54.  
  55. void wyswietl_oceny( student student )
  56. {
  57.     for( int i = 0; i < MAX; i++ )
  58.     {
  59.         printf( "%f\t", student.oceny[ i ] );
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement