修改文件结构。

This commit is contained in:
unlockable
2023-02-21 10:56:54 +08:00
parent a64cfdd9f3
commit 40182871f4
83 changed files with 0 additions and 0 deletions

32
POP/10/Exercise01.c Normal file
View File

@@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
bool compareChar(char examinee, char pattern) {
if(pattern == '?' || pattern == examinee) {
return true;
}
else {
return false;
}
}
int main() {
int index = 0, shift = 0;
bool same = false;
char sA[31] = {0}, sB[31] = {0};
scanf("%s", sA);
scanf("%s", sB);
for (index = 0; index <= strlen(sA) - strlen(sB); index++) {
same = true;
for (shift = 0 ; shift < strlen(sB) && same; shift++) {
if (!compareChar(sA[index+shift], sB[shift])) {
same = false;
}
}
if (same) {
printf("%d ", index);
}
}
return 0;
}