From 4224709fbe467c81402047685e734b17b407e95a Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Wed, 2 Oct 2024 19:29:16 +0000 Subject: [PATCH] Update cv1/program.c --- cv1/program.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index 05a2d90..347dc2d 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -5,7 +5,7 @@ // bool check(char* s2, char *pz) { - char s[300]; + char s[300], p[300]; if(s2==NULL || pz==NULL) { return false; @@ -15,6 +15,7 @@ bool check(char* s2, char *pz) // { // return false; // } + // 0123456789 char shifer[15]="oizeasbtbq"; for(int i = 0; s2[i]!='\0'; i++) @@ -28,7 +29,20 @@ bool check(char* s2, char *pz) } } s[strlen(s2)]=0; - bool rez=strstr(s, pz)!=NULL; + + for(int i = 0; pz[i]!='\0'; i++) + { + //printf("%d ",i); + p[i] = tolower(pz[i]); + if(p[i] >='0' && p[i]<='9') + { + p[i]=shifer[p[i]-'0']; + } + } + p[strlen(pz)]=0; + + //printf("========= %s %s %s", s2,pz,) + bool rez=strstr(s, p)!=NULL; //free(s); return rez; @@ -62,8 +76,7 @@ int main() break; } if(check(r, pizz)) - { - + { printf("%s%.2f\n", r, price); } count++;