refresh
This commit is contained in:
parent
f4a8423b5b
commit
a8b5a3156c
BIN
du1/output/program.exe
Normal file
BIN
du1/output/program.exe
Normal file
Binary file not shown.
@ -1,7 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#define LINESIZE 100
|
||||
|
||||
struct pizza {
|
||||
float size;
|
||||
char name[LINESIZE];
|
||||
};
|
||||
|
||||
|
||||
void deshifr (char *text) {
|
||||
for (int i = 0; text[i] != '\0'; i++) {
|
||||
switch (text[i]) {
|
||||
@ -40,14 +47,31 @@ void deshifr (char *text) {
|
||||
}
|
||||
}
|
||||
|
||||
int search_string (const char* heap_orig, const char* needle_orig) {
|
||||
char heap[LINESIZE];
|
||||
char needle[LINESIZE];
|
||||
strcpy (heap, heap_orig);
|
||||
strcpy (needle, needle_orig);
|
||||
deshifr(heap);
|
||||
deshifr(needle);
|
||||
int heap_len = strlen(heap);
|
||||
int needle_len = strlen(needle);
|
||||
|
||||
for (int i = 0; i <= heap_len - needle_len; i++) {
|
||||
int j;
|
||||
for (j = 0; j < needle_len; j++) {
|
||||
if (heap[i+j] != needle[j]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == needle_len) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
struct pizza {
|
||||
float prize;
|
||||
char name[LINESIZE];
|
||||
};
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user