v4
This commit is contained in:
parent
4413ab7729
commit
34e94374ad
@ -2,6 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
struct item {
|
struct item {
|
||||||
char name[50];
|
char name[50];
|
||||||
@ -85,6 +86,7 @@ int main(){
|
|||||||
int input_search_size = strlen(input_search);
|
int input_search_size = strlen(input_search);
|
||||||
int match_counter = 1;
|
int match_counter = 1;
|
||||||
int new_start = 0;
|
int new_start = 0;
|
||||||
|
char input_search_up = toupper(input_search[0]);
|
||||||
//find match in menu
|
//find match in menu
|
||||||
for(int i = 0; i < meal_counter; i++){
|
for(int i = 0; i < meal_counter; i++){
|
||||||
new_start = 0;
|
new_start = 0;
|
||||||
@ -92,12 +94,12 @@ int main(){
|
|||||||
//loop through each item name
|
//loop through each item name
|
||||||
for(int j = 0; j < strlen(backup_menu[i].name); j++){
|
for(int j = 0; j < strlen(backup_menu[i].name); j++){
|
||||||
//if some word starts with first letter of input
|
//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;
|
new_start = j;
|
||||||
//loop through each letter in input_search
|
//loop through each letter in input_search
|
||||||
for(int k = 0; k < input_search_size; k++){
|
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++;
|
match_counter++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user