Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <time.h>
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- using namespace std;
- struct ksiazka
- {
- int l_stron;
- char tytul[30];
- char autor[30];
- };
- void AlokacjaK(ksiazka ***tab, int ile)
- {
- if (tab==NULL)
- {
- puts("error");
- }
- (*tab) = (ksiazka**)malloc(ile*sizeof(ksiazka*));
- for (int i = 0; i < ile, i++)
- {
- (*tab)[i] = (ksiazka*)malloc(sizeof(ksiazka));
- }
- }
- void DodajK( ksiazka ***tab, int ile)
- {
- for(int i=0; i<ile; i++) {
- strcpy((*tab)[i]->l_stron,200);
- strcpy((*tab)[i]->stytul,"Pamietnik");
- strcpy((*tab)[i]->autor, "Jan Stefan");
- }
- }
- void PokazK( ksiazka ***tab, int ile)
- {
- for(int i=0; i<ile; i++) {
- printf("Ksiazki seria nr: %d \n",i+1);
- printf("Liczba stron: %s \n",(*tab)[i]->l_stron);
- printf("Pracownik ochrony: %s \n",(*tab)[i]->tytul);
- printf("Pracownik normalny: %s \n \n",(*tab)[i]->autor);
- }
- }
- void UsunK( ksiazka **tab) {
- free(*tab);
- }
- int main()
- {
- int ile;
- printf("Podaj liczbe jednostek sklepu do wyswietlenia:\n");
- scanf("&d",&ile);
- ksziaka **ks = NULL;
- AlokacjaK(&ks,ile);
- DodajK(&ks,ile);
- PokazK(&ks,ile);
- UsunK(&ks,ile);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement