changes
This commit is contained in:
parent
cca93eb82e
commit
e56d74a760
@ -9,7 +9,7 @@ struct stack{
|
|||||||
int size;
|
int size;
|
||||||
}stack;
|
}stack;
|
||||||
|
|
||||||
///add bracket to stack
|
///add bracket to stack and increment size
|
||||||
|
|
||||||
void push(char ch){
|
void push(char ch){
|
||||||
if(stack.size < 100){
|
if(stack.size < 100){
|
||||||
@ -102,7 +102,7 @@ int main(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
c_bracket[f] = 0; //if closing bracket is correct then reducee array
|
c_bracket[f] = 0; //if closing bracket is correct then reducee array
|
||||||
f--; //if i didn't find a correct bracket, then keep it in the array
|
f--; //if i didn't find a correct bracket, then keep it in the array c_bracket
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ struct pizza{
|
|||||||
float prize;
|
float prize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//read menu
|
||||||
|
|
||||||
int read_pizza(struct pizza* item){
|
int read_pizza(struct pizza* item){
|
||||||
|
|
||||||
char line1[LINESIZE];
|
char line1[LINESIZE];
|
||||||
@ -16,19 +18,22 @@ int read_pizza(struct pizza* item){
|
|||||||
|
|
||||||
memset(line1, 0, LINESIZE);
|
memset(line1, 0, LINESIZE);
|
||||||
memset(line2, 0, LINESIZE);
|
memset(line2, 0, LINESIZE);
|
||||||
char *l1 = fgets(line1,LINESIZE,stdin);
|
char *l1 = fgets(line1,LINESIZE,stdin); //read first line(name)
|
||||||
char *l2 = fgets(line2,LINESIZE,stdin);
|
char *l2 = fgets(line2,LINESIZE,stdin); //read second line(price)
|
||||||
float value = strtof(line2, &l2);
|
float value = strtof(line2, &l2); //change char to float, because price is a nummber
|
||||||
if(value == 0.0F){
|
if(value == 0.0F){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(l1 != NULL && line1[1] != 0){
|
if(l1 != NULL && line1[1] != 0){ //check if array with name is not empty
|
||||||
item->prize = value;
|
item->prize = value;
|
||||||
strcpy(item->name, line1);
|
strcpy(item->name, line1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check every place where the string might be
|
||||||
|
//if there isn't at first place, go to the second etc.
|
||||||
|
|
||||||
int search_string(const char* heap, const char* needle){
|
int search_string(const char* heap, const char* needle){
|
||||||
|
|
||||||
int H = strlen(heap);
|
int H = strlen(heap);
|
||||||
@ -100,11 +105,14 @@ int main(){
|
|||||||
int i, j;
|
int i, j;
|
||||||
for(i = 0; i < counter; i++){
|
for(i = 0; i < counter; i++){
|
||||||
for(j = 0; j < strlen(jedalny_listok[i].name); j++){
|
for(j = 0; j < strlen(jedalny_listok[i].name); j++){
|
||||||
|
//change menu with help of hacher_script
|
||||||
pomocny[i].name[j] = hacker_script(jedalny_listok[i].name[j]);
|
pomocny[i].name[j] = hacker_script(jedalny_listok[i].name[j]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//check if there is key in the menu
|
||||||
int result = search_string(pomocny[i].name, key);
|
int result = search_string(pomocny[i].name, key);
|
||||||
if(result != -1){
|
if(result != -1){
|
||||||
|
//if there is a key, print name and price
|
||||||
printf("%s", jedalny_listok[i].name);
|
printf("%s", jedalny_listok[i].name);
|
||||||
printf("%.2f\n", jedalny_listok[i].prize);
|
printf("%.2f\n", jedalny_listok[i].prize);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ void print_train(struct car* first);
|
|||||||
* Zrusenie vsetkych voznov vo vlaku.
|
* Zrusenie vsetkych voznov vo vlaku.
|
||||||
* @arg smernik na prvy vozen
|
* @arg smernik na prvy vozen
|
||||||
*/
|
*/
|
||||||
void cancel_train(struct car* first, int val);
|
void cancel_train(struct car* first);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vyradenie vsetkych voznov, ktorych cielova stanica je target
|
* Vyradenie vsetkych voznov, ktorych cielova stanica je target
|
||||||
|
Loading…
Reference in New Issue
Block a user