This commit is contained in:
Radovan Kofira 2020-10-05 00:49:09 +02:00
parent 2c72ff9c41
commit a631cc7d3f
2 changed files with 7 additions and 8 deletions

View File

@ -61,22 +61,21 @@ void trim(char* str){
int search_string(const char* heap, const char* needle){ int search_string(const char* heap, const char* needle){
int M=strlen(needle); int M=strlen(needle);
int N=strlen(heap); int N=strlen(heap);
//printf("needle:%d heap: %d\n",M,N);
for(int i=0;i<=N-M;i++){ for(int i=0;i<=N-M;i++){
int j; int j;
for(j=0;j<M;j++){ for(j=0;j<M;j++){
//printf("heap:%c\n",hacker_script(heap[i+j])); //printf("heap:%c\n",hacker_script(heap[i+j]));
//printf("needle:%c\n",hacker_script(needle[j])); //printf("needle:%c\n",hacker_script(needle[j]));
if(hacker_script(heap[i+j])!=hacker_script(needle[j])){ if(hacker_script(heap[i+j])!=hacker_script(needle[j])){
break; break;
} }
} }
if(j==M){ if(j==M){
return i; return i;
} }
else{
return -1;
}
} }
return -1;
} }
int read_pizza(struct pizza* item){ int read_pizza(struct pizza* item){
char line[LINE_SIZE]; char line[LINE_SIZE];

Binary file not shown.