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