diff --git a/cv1/program.c b/cv1/program.c index 429cd93..5d57071 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,5 +1,7 @@ #include #include +#include +#include #define LINESIZE 100 #define LINE_SIZE 100 @@ -10,10 +12,22 @@ struct pizza { }; int main(){ + //struct pizza tuniakova; + struct pizza nulova; + struct pizza tuniakova = { + .name="Tuniakova", + .prize=2.3 + }; int POCET_JEDAL=0; + // Nastavíme všetky bajty pamäte na nulu + // Alebo staticky priradime nejake hodnoty + memset(&tuniakova, 0,sizeof(struct pizza)); + // Pozor, táto inicializácia funguje iba na novších prekladačoch struct pizza jedalny_listok[POCET_JEDAL]; // Na začiatku celé pole vynulujeme, všetky pizze sú nulové + memset(jedalny_listok, 0,sizeof(struct pizza)*POCET_JEDAL); + struct pizza *prva = jedalny_listok; struct pizza *druha = jedalny_listok + 1; struct pizza *tretia = &jedalny_listok[2]; @@ -31,24 +45,45 @@ int main(){ printf("%s",line); } } + //float value = strtof(line);//line2 + //if (value == 0.0F){ + // return 0; + //} + //item->prize = value; + //strcpy(item->name, line); + /*return 1; + struct pizza item; + int counter = 1; + while(read_pizza(stdin,&item)){ + counter += 1; + printf("%s",item->name); + printf("%.2f",item->prize); + }*/ //printf("%s má cenu %.2f\n",item->name,item->prize); - char hacker_script(char c); + //char hacker_script(char c); 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]; + } + char hacker_script(char c){ + char numbers[] = "0123456789"; + char letters[] = "oizeasbtbq"; + for (int i = 0; i < 10; i++){ + tolower(c); + if (c == numbers[i]){ + return letters[i]; + } } } -} -////////////////////// -////////////////////// -////////////////////// -////////////////////// -////////////////////// -////////////////////// -////////////////////// -// ////////////////// \ No newline at end of file +//////////////////////// +// ///////// +// //////// ////// +// //////// ////// +// //////// ////// +// //////// ////// +// // ///////// +// ///////////// +// /// /////////// +// //// ////////// +// ///// ///////// +// ////// //////// +// /////// /////// +//////////////////////// \ No newline at end of file diff --git a/cv1/program.exe b/cv1/program.exe new file mode 100644 index 0000000..18e5301 Binary files /dev/null and b/cv1/program.exe differ