-
Notifications
You must be signed in to change notification settings - Fork 0
/
cwiczenie7.cpp
38 lines (29 loc) · 853 Bytes
/
cwiczenie7.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <stdlib.h>
#define N 10
int main()
{
char student[N][3][80];
int ilosc_studentow = 0;
char buf[80];
char imie[] = "Imie";
char nazwisko[] = "Nazwisko";
char adres[] = "Adres";
for(int i = 0; ; i++)
{
printf("Podaj imie, nazwisko oraz adres studenta: ");
fgets(buf, 80, stdin);
fflush(stdin);
if(buf[0] == 10)
break;
sscanf(buf, "%12s %12s %16s", student[i][0], student[i][1], student[i][2]);
ilosc_studentow++;
if(i == N-1)
break;
}
printf("\n %-12s \t %-12s \t%-16s", imie, nazwisko, adres);
for(int i = 0; i < ilosc_studentow; i++)
printf("\n %-12s \t %-12s \t%-16s", student[i][0], student[i][1], student[i][2]);
getchar();
return 0;
}