标签:io for ar amp ad c har 字符串 as
#include <stdio.h>
#include <string.h>
void main()
{
char str[] = "asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafa";
int i = 0,num = 0;
for(i = 0; i < strlen(str) - 1; i++)
{
if(str[i] == ‘a‘ && str[i + 1] == ‘f‘)
{
num++;
}
}
printf("找到%d个af\n",num);
}
查找“asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafd” 该字符串中有多少个af
标签:io for ar amp ad c har 字符串 as
原文地址:http://www.cnblogs.com/ghost12/p/3935799.html