From 301ac041da3b5533e5919308194d72db4dbceb42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Cabra?= Date: Fri, 11 Oct 2019 09:06:01 +0000 Subject: [PATCH] Aktualizovat "program.c --- vyhladaj.c => program.c | 294 ++++++++++++++++++++-------------------- 1 file changed, 147 insertions(+), 147 deletions(-) rename vyhladaj.c => program.c (95%) diff --git a/vyhladaj.c b/program.c similarity index 95% rename from vyhladaj.c rename to program.c index bd3f450..027693a 100644 --- a/vyhladaj.c +++ b/program.c @@ -1,147 +1,147 @@ -#include -#include -#include - -/* run this program using the console pauser or add your own getch, system("pause") or input loop */ - -#define LINE_SIZE 100 - -struct pizza { - float prize; - char name[LINE_SIZE]; -}; - -int read_pizza(struct pizza* item); -int search_string(const char* heap, const char* needle); -char hacker_script(char c); - -int main(int argc, char *argv[]) { - - printf("Zadaj hladanu surovinu:\n"); - printf("Zadaj jedalny listok:\n"); - - char string[LINE_SIZE]; - memset(string,0,LINE_SIZE); - - char *r = fgets(string,LINE_SIZE,stdin); - if(r != NULL && string[1] != 0){ - char *pos; - if ((pos=strchr(string, '\n')) != NULL) - *pos = '\0'; - //printf("Hladane jedlo: %s",string); - struct pizza item; - int counter = 0; - while(read_pizza(&item)){ - counter += 1; - //int x = strlen(item.name); - //printf("Dlzka %d\n",x); - /*int i; - for(i=0;iprize = value; - strcpy(item->name, line); - return 1; - } - else{ - return 0; - } - } - else{ - return 0; - } - } -} - -char hacker_script(char c){ - - char big_letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - char small_letters[] = "abcdefghijklmnopqrstuvwxyz"; - for (int i = 0; i < 26; i++){ - if (c == big_letters[i]){ - //printf(" Nahradzujem %c za %c\n",big_letters[i],small_letters[i]); - return small_letters[i]; - } - } - - char numbers[] = "0123456789"; - char letters[] = "oizeasbtbq"; - for (int i = 0; i < 10; i++){ - if (c == numbers[i]){ - //printf(" Nahradzujem %c za %c\n",numbers[i],letters[i]); - return letters[i]; - } - } - return '0'; -} - -int search_string(const char* heap, const char* needle){ - - char needle_2[strlen(needle)]; - strcpy(needle_2,needle); - - int a; - for(a=0;a +#include +#include + +/* run this program using the console pauser or add your own getch, system("pause") or input loop */ + +#define LINE_SIZE 100 + +struct pizza { + float prize; + char name[LINE_SIZE]; +}; + +int read_pizza(struct pizza* item); +int search_string(const char* heap, const char* needle); +char hacker_script(char c); + +int main(int argc, char *argv[]) { + + printf("Zadaj hladanu surovinu:\n"); + printf("Zadaj jedalny listok:\n"); + + char string[LINE_SIZE]; + memset(string,0,LINE_SIZE); + + char *r = fgets(string,LINE_SIZE,stdin); + if(r != NULL && string[1] != 0){ + char *pos; + if ((pos=strchr(string, '\n')) != NULL) + *pos = '\0'; + //printf("Hladane jedlo: %s",string); + struct pizza item; + int counter = 0; + while(read_pizza(&item)){ + counter += 1; + //int x = strlen(item.name); + //printf("Dlzka %d\n",x); + /*int i; + for(i=0;iprize = value; + strcpy(item->name, line); + return 1; + } + else{ + return 0; + } + } + else{ + return 0; + } + } +} + +char hacker_script(char c){ + + char big_letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + char small_letters[] = "abcdefghijklmnopqrstuvwxyz"; + for (int i = 0; i < 26; i++){ + if (c == big_letters[i]){ + //printf(" Nahradzujem %c za %c\n",big_letters[i],small_letters[i]); + return small_letters[i]; + } + } + + char numbers[] = "0123456789"; + char letters[] = "oizeasbtbq"; + for (int i = 0; i < 10; i++){ + if (c == numbers[i]){ + //printf(" Nahradzujem %c za %c\n",numbers[i],letters[i]); + return letters[i]; + } + } + return '0'; +} + +int search_string(const char* heap, const char* needle){ + + char needle_2[strlen(needle)]; + strcpy(needle_2,needle); + + int a; + for(a=0;a