Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define vel 100
- struct osoba
- {
- char ime[15];
- char prezime[15];
- int broj;
- };
- struct osoba unososobe()
- {
- struct osoba osoba;
- printf("Unesite ime osobe:\n");
- scanf("%c", &osoba.ime );
- printf("Unesite prezime osobe:\n");
- scanf("%c", &osoba.prezime);
- printf("Unesite broj telefona:\n");
- scanf("%d", &osoba.broj);
- }
- void ispisosobe(struct osoba osoba)
- {
- printf ("%s %s - telefon: %09d",osoba.ime, osoba.prezime, osoba.broj );
- }
- int meni()
- {
- int izbor;
- printf("Pritisnite 1 z UNOS, 2 za ISPIS, 0 za IZLAZ: ");
- scanf("%d", &izbor);
- return izbor;
- }
- int main()
- {
- struct osoba osobe[vel];
- int i=0, izbor, broj=0;
- do {
- izbor=meni();
- switch(izbor) {
- case 1:
- if (broj< vel)
- {
- osobe[broj]=unososobe();
- broj ++;
- }
- else printf("Nije moguce unijeti vise od %d osoba! \n ", vel);
- break;
- case 2:
- for (i=0; i<vel; i++)
- ispisosobe(osobe[i]);
- break;
- } }
- while(izbor!=0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment