#include<stdio.h>
#include<string.h>
char* find(char* a, char b)
{
while (*a != b && *a != '\0')
{
a++;
}
return *a == b ? a : NULL;
}
int main()
{
char* c;
char e[20];
char d='a';
printf("Type down the character you want to find in a string:(q tot quit)");
while (d != 'q')
{
c = fgets(e, 20, stdin);
d = getchar();
c = find(c, d);
fputs(c, stdout);
while (d != '\n')
{
d = getchar();
continue;
}
printf("Next string and character?:(q to quit)");
d = getchar();
}
printf("Bye");
return 0;
}
c primer plus第十一章编程题5
最新推荐文章于 2024-07-08 14:40:44 发布