From f1c2d4bd6cd346c00c6a5ac1a5e20e88603545eb Mon Sep 17 00:00:00 2001 From: Radovan Kofira Date: Fri, 9 Oct 2020 12:19:52 +0200 Subject: [PATCH] aaa --- cv2/program.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 cv2/program.c diff --git a/cv2/program.c b/cv2/program.c new file mode 100644 index 0000000..2ada0f3 --- /dev/null +++ b/cv2/program.c @@ -0,0 +1,125 @@ +#include +#include +#include +#include + +#define LINESIZE 100 +#define LINE_SIZE 100 +#define POCET_JEDAL 10 +struct pizza { + float prize; + char name[LINESIZE]; +}; +void trim(char* str); +int search_string(const char* heap, const char* needle); +int read_pizza(struct pizza* item); +char hacker_script(char c); + +int main(){ + struct pizza jedalny_listok[POCET_JEDAL]; + memset(jedalny_listok, 0,sizeof(struct pizza)*POCET_JEDAL); + int counter=0; + char line[LINE_SIZE]; + memset(line,0,LINE_SIZE); + printf("Zadaj hladanu surovinu:\n"); + char* r = fgets(line,LINE_SIZE,stdin); + trim(line); + if(r != NULL && line[1] != 0){ + printf("Zadaj jedalny listok:\n"); + struct pizza item; + while(read_pizza(&item)){ + strcpy(jedalny_listok[counter].name, item.name); + jedalny_listok[counter].prize=item.prize; + //printf("%s",jedalny_listok[counter].name); + //printf("%s",item.name); + counter += 1; + //printf("%d\n",counter); + if (counter>=POCET_JEDAL) + { + break; + } + } + } + //printf("%d\n",counter); + for(int i=0;iprize = value; + strcpy(item->name, line); + return 1; + } + return 0; +} + + char hacker_script(char c){ + char numbers[] = "0123456789"; + char letters[] = "oizeasbtbq"; + for (int i = 0; i < 10; i++){ + if (c == numbers[i]){ + return letters[i]; + } + } + return tolower(c); + } + +//////////////////////// +// ///////// +// /////// /////// +// //////// /////// +// //////// /////// +// ////// //////// +// //// ////////// +// ///////////// +// /// /////////// +// //// ////////// +// ///// ///////// +// ////// //////// +// /////// /////// +//////////////////////// \ No newline at end of file