usaa21/cv1/program.c

77 lines
1.5 KiB
C
Raw Normal View History

2021-10-07 19:02:49 +00:00
#include <stdlib.h>
2021-09-28 14:26:25 +00:00
#include <stdio.h>
2021-10-04 15:54:42 +00:00
#include <string.h>
#define LINESIZE 100
2021-10-07 19:02:49 +00:00
// Prepáčte za 0 bodov, moja chyba, uloha mi trvá viac času ako som plánoval, preto nestíham odovzdať zadanie správne. Ja pevne verím, že viac krát sa to už nezopakuje a ďalšie zadania už nebudú 0. Korpesio
2021-10-04 15:54:42 +00:00
struct Pizza {
float prize;
char name[LINESIZE];
};
2021-10-07 19:02:49 +00:00
struct hladany {
char item[LINESIZE];
};
//int nacitaj(struct pizza* item)
2021-10-06 16:43:24 +00:00
//int matches(heap, needle){
// return 0;
2021-10-04 15:54:42 +00:00
2021-10-06 16:43:24 +00:00
//}
//char hacker_script(char c){
// if (c == '5'){
// r == 'S';
// }
// return r;
//}
2021-09-28 14:26:25 +00:00
int main (){
2021-10-06 16:43:24 +00:00
size_t velkost = 0;
char line[LINESIZE];
memset(line, 0, LINESIZE);
2021-10-07 19:02:49 +00:00
char name[LINESIZE];
int prvy = 0;
char item[LINESIZE];
struct hladany nazov;
struct Pizza jedalny_listok;
memset(nazov, 0,sizeof(struct hladany));
memset(jedalny_listok, 0, sizeof(struct Pizza)*LINESIZE);
int i = 0;
2021-10-06 16:43:24 +00:00
//char search_string[LINESIZE] = "Ostiepkova";
2021-10-07 19:02:49 +00:00
while(fgets(line, LINESIZE, stdin)){
2021-10-06 16:43:24 +00:00
velkost = strlen(line);
2021-10-07 19:02:49 +00:00
if (velkost == 1){
2021-10-06 16:43:24 +00:00
printf("%s", line);
2021-10-04 15:54:42 +00:00
break;
}
2021-10-07 19:02:49 +00:00
if(prvy==0){
2021-10-06 16:43:24 +00:00
2021-10-07 19:02:49 +00:00
strcpy(nazov.item, line);
printf("%s", nazov.item);
prvy++;
}
if (prvy %2! = 0){
POCET_JEDAL++;
strcpy(jedalny_listok.name[i], line);
printf("%s", jedalny_listok.name[i]);
i++;
}
2021-10-06 16:43:24 +00:00
//if (matches(search_string. line)){
// printf("%s", pizza->name);
//}
2021-10-04 15:54:42 +00:00
2021-10-06 16:43:24 +00:00
// strcpy(pizz->name, line);
// if (matches(search_string, line)){
// printf("%s", pizza->name)
// }
//
2021-10-07 19:02:49 +00:00
2021-10-04 15:54:42 +00:00
return 0;
2021-09-28 14:26:25 +00:00
}