Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- struct cukierek{
- char producent[15];
- char nazwa[15];
- float cena;
- float data;
- };
- struct cukierek wczytaj();
- void wypisz(struct cukierek os);
- float cenakg(struct cukierek os, int min, int max);
- char przeterminowane(struct cukierek os, int data);
- int main(int argc, char *argv[]) {
- int n,i;
- printf("Ile cukierkow chcesz wprowadzic?\n");
- scanf("%d",&n);
- struct cukierek os[n];
- for(i=0;i<n;i++){
- fflush(stdin);
- printf("Slodycz numer %d\n", i+1);
- os[i]=wczytaj();
- printf("\n");
- }
- for(i=0;i<n;i++){
- printf("Slodycz numer %d\n", i+1);
- wypisz(os[i]);
- }
- return 0;
- }
- struct cukierek wczytaj(){
- struct cukierek os;
- printf("Podaj producenta:\n");
- scanf("%s",os.producent);
- printf("Podaj nazwe:\n");
- scanf("%s",os.nazwa);
- printf("Podaj cene za kilogram:\n");
- scanf("%f",os.cena);
- printf("Podaj date waznosci produktu:\n");
- scanf("%f",os.data);
- }
- void wypisz(struct cukierek os){
- printf("%s %s %f PLN %f", os.producent,os.nazwa,os.cena,os.data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement