c语言编程-字符串中查找字符位置 思路:用两个字符数组,一个负责接收输入,一个负责筛选*号前的待查找字符串
#include<stdio.h>
int main()
{char a
[100],b
[100];
char c
;
int p
=1,q
=0;
gets(a
);
for(int j
=0;a
[j
]!='*';j
++)
{b
[j
]=a
[j
];
q
++;
}
c
=a
[q
+1];
for(int i
=0;b
[i
]!=0;i
++)
{if (b
[i
]==c
) break;
else
p
++;
}
printf("%d",p
);
}
转载请注明原文地址: https://yun.8miu.com/read-21733.html