This commit is contained in:
Valér Jakubčo 2021-10-07 23:29:59 +02:00
parent 4413ab7729
commit 34e94374ad

View File

@ -2,6 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
struct item {
char name[50];
@ -85,6 +86,7 @@ int main(){
int input_search_size = strlen(input_search);
int match_counter = 1;
int new_start = 0;
char input_search_up = toupper(input_search[0]);
//find match in menu
for(int i = 0; i < meal_counter; i++){
new_start = 0;
@ -92,12 +94,12 @@ int main(){
//loop through each item name
for(int j = 0; j < strlen(backup_menu[i].name); j++){
//if some word starts with first letter of input
if(backup_menu[i].name[j] == input_search[0]){
if((backup_menu[i].name[j] == input_search[0]) || (backup_menu[i].name[j] == input_search_up)){
new_start = j;
//loop through each letter in input_search
for(int k = 0; k < input_search_size; k++){
if(backup_menu[i].name[new_start] == input_search[k]){
if(backup_menu[i].name[new_start] == input_search[k] || backup_menu[i].name[new_start] == input_search_up ){
match_counter++;
}