2024-09-30 13:22:26 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
2024-09-30 20:08:14 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
//
|
|
|
|
bool check(char* s2, char *pz)
|
2024-09-30 13:22:26 +00:00
|
|
|
{
|
2024-09-30 20:08:14 +00:00
|
|
|
char *s=(char*) malloc(strlen(s2)+1);
|
2024-09-30 13:22:26 +00:00
|
|
|
char shifer[85]="oizeasbtbq";
|
2024-09-30 20:08:14 +00:00
|
|
|
|
2024-09-30 20:20:35 +00:00
|
|
|
for(int i = 0; s2[i]!='\0'; i++)
|
2024-09-30 13:22:26 +00:00
|
|
|
{
|
2024-09-30 20:08:14 +00:00
|
|
|
//printf("%d ",i);
|
|
|
|
s[i]=tolower(s2[i]);
|
2024-09-30 13:22:26 +00:00
|
|
|
if(s[i] >='0' && s[i]<='9')
|
2024-09-30 20:08:14 +00:00
|
|
|
{
|
|
|
|
|
2024-09-30 13:22:26 +00:00
|
|
|
s[i]=shifer[s[i]-'0'];
|
2024-09-30 20:08:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
bool rez=strstr(s, pz)!=NULL;
|
2024-09-30 20:25:34 +00:00
|
|
|
free(s);
|
2024-09-30 20:08:14 +00:00
|
|
|
return rez;
|
2024-09-30 13:22:26 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
2024-09-30 20:08:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
char r[300];//="8ryNd20va P1zza";
|
|
|
|
char pizz[99];//="piz";
|
|
|
|
char *p;
|
|
|
|
float price;
|
|
|
|
int count =0;
|
2024-09-30 20:20:35 +00:00
|
|
|
printf("Zadaj hladanu surovinu:\n");
|
2024-09-30 20:08:14 +00:00
|
|
|
scanf("%s", pizz);
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
2024-09-30 20:20:35 +00:00
|
|
|
printf("Zadaj␣jedalny␣listok:\n");
|
2024-09-30 20:08:14 +00:00
|
|
|
do
|
|
|
|
p=fgets(r, 299, stdin);
|
2024-10-01 13:12:38 +00:00
|
|
|
while(p!=NULL || p[0]=='\n');
|
2024-09-30 20:08:14 +00:00
|
|
|
if(p==NULL)
|
2024-09-30 20:20:35 +00:00
|
|
|
break;
|
2024-09-30 20:08:14 +00:00
|
|
|
if(scanf("%f", &price)!=1)
|
2024-09-30 20:20:35 +00:00
|
|
|
break;
|
2024-09-30 20:08:14 +00:00
|
|
|
if(check(r, pizz))
|
|
|
|
{
|
|
|
|
count++;
|
|
|
|
printf("%s %.2f\n", r, price);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("Nacitanyh %d poloziek", count);
|
|
|
|
|
2024-09-30 13:22:26 +00:00
|
|
|
return 0;
|
|
|
|
}
|