From 34e94374ad3a10479c62c6227454f8099fe16a6f Mon Sep 17 00:00:00 2001 From: vj586da Date: Thu, 7 Oct 2021 23:29:59 +0200 Subject: [PATCH] v4 --- cv1/program.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 7268641..0eb7a8b 100755 --- a/cv1/program.c +++ b/cv1/program.c @@ -2,6 +2,7 @@ #include #include #include +#include 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++; }