aa
This commit is contained in:
parent
6266b9d3fa
commit
afee46bfbf
@ -6,58 +6,59 @@
|
|||||||
#define LINESIZE 100
|
#define LINESIZE 100
|
||||||
#define LINE_SIZE 100
|
#define LINE_SIZE 100
|
||||||
|
|
||||||
|
|
||||||
struct pizza {
|
struct pizza {
|
||||||
float prize;
|
float prize;
|
||||||
char name[LINESIZE];
|
char name[LINESIZE];
|
||||||
};
|
};
|
||||||
struct pizza nulova;
|
|
||||||
struct pizza tuniakova = {
|
|
||||||
.name="Tuniakova",
|
|
||||||
.prize=2.3
|
|
||||||
};
|
|
||||||
|
|
||||||
|
int read_pizza(struct pizza* item);
|
||||||
int main(){
|
int main(){
|
||||||
int POCET_JEDAL=0;
|
int POCET_JEDAL=0;
|
||||||
struct pizza jedalny_listok[POCET_JEDAL];
|
struct pizza jedalny_listok[POCET_JEDAL];
|
||||||
// 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);
|
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];
|
|
||||||
|
|
||||||
char line[LINE_SIZE];
|
char line[LINE_SIZE];
|
||||||
while (1){
|
|
||||||
// Inicializujem pamäť
|
|
||||||
memset(line,0,LINE_SIZE);
|
memset(line,0,LINE_SIZE);
|
||||||
// Do poľa načítam max. LINE_SIZE znakov zo štandardnéhgo vstupu.
|
|
||||||
char* r = fgets(line,LINE_SIZE,stdin);
|
char* r = fgets(line,LINE_SIZE,stdin);
|
||||||
// Overím si či bolo načítanie úspešné.
|
if(r != NULL && line[1] != 0){
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
struct pizza item;
|
struct pizza item;
|
||||||
int counter = 1;
|
int counter = 1;
|
||||||
/* while(read_pizza(stdin,&item)){
|
while(read_pizza(&item)){
|
||||||
counter += 1;
|
counter += 1;
|
||||||
printf("%s",item.name);
|
printf("%s",item.name);
|
||||||
printf("%.2f",item.prize);
|
printf("%.2f\n",item.prize);
|
||||||
}*/
|
|
||||||
}
|
|
||||||
int search_string(const char* heap, const char* needle){
|
|
||||||
char pole[5]="abcd";
|
|
||||||
for (int i = 0; i < 5; i++){
|
|
||||||
printf("%c",pole[i+1]);
|
|
||||||
}
|
}
|
||||||
}/*
|
}
|
||||||
int read_pizza(stdin,&item){
|
}
|
||||||
|
|
||||||
|
int search_string(const char* heap, const char* needle){
|
||||||
|
int M=strlen(needle);
|
||||||
|
int N=strlen(heap);
|
||||||
|
for(int i=0;i<=N-M;i++){
|
||||||
|
int j;
|
||||||
|
for(j=0;j<M;j++){
|
||||||
|
if(heap[i+j]!=needle[j])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(j==M){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_pizza(struct pizza* item){
|
||||||
char line[LINE_SIZE];
|
char line[LINE_SIZE];
|
||||||
float value = strtof(line,NULL);
|
memset(line,0,LINE_SIZE);
|
||||||
// Ak je návratová hodnota nula, premena reťazca sa nepodarila.
|
char* r = fgets(line,LINE_SIZE,stdin);
|
||||||
|
|
||||||
|
if(r != NULL && line[1] != 0){
|
||||||
|
char line2[LINE_SIZE];
|
||||||
|
memset(line2,0,LINE_SIZE);
|
||||||
|
fgets(line2,LINE_SIZE,stdin);
|
||||||
|
float value = strtof(line2,NULL);
|
||||||
if (value == 0.0F){
|
if (value == 0.0F){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -65,17 +66,16 @@ int main(){
|
|||||||
strcpy(item->name, line);
|
strcpy(item->name, line);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
char hacker_script(char c){
|
char hacker_script(char c){
|
||||||
char numbers[] = "0123456789";
|
char numbers[] = "0123456789";
|
||||||
char letters[] = "oizeasbtbq";
|
char letters[] = "oizeasbtbq";
|
||||||
for (int i = 0; i < 10; i++){
|
for (int i = 0; i < 10; i++){
|
||||||
tolower(c);
|
|
||||||
if (c == numbers[i]){
|
if (c == numbers[i]){
|
||||||
return letters[i];
|
return letters[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return tolower(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
|
BIN
cv1/program.exe
BIN
cv1/program.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user