编写一个函数fun(char str[]),其功能是统计一个字符串中所包含的英文字母的个数?

编写一个函数fun(char str[]),其功能是统计一个字符串中所包含的英文字母的个数?,第1张

#include <stdioh>

int fun(char str[])

{

int i,n=0;

for(i=0;str[i];i++)

if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')

n++;

return n;

}

void main()

{

char k[60];

gets(k);

printf("%d\n", fun(k));

}

#include <stdioh>

int max(int a,int b,int c)

{

int m=a;

if(b>m)m=b;

if(c>m)m=c;

return m;

}

int main()

{

printf("max=%d\n",max(1,2,3));

return 0;

}

#include <stdioh>

#include <stringh>

#include <malloch>

int search(char strSource, char strFind)

{

int find_len=strlen(strFind);

int i=0;

int flag=0;

while( (strSource+i) != '\0' ){

if((strSource+i) == strFind){

if(strncmp(strSource+i,strFind,find_len) ==0){

flag++;

}

}

i++;

}

if(flag!=0){

printf("----找到了[%d]次---\n",flag);

}else{

printf("----没有找到---\n");

}

return 0;

}

int main()

{

char strSource[100] ="three boys have swum across three rivers for three times in three days";

char strFind[10] = "three";

search(strSource,strFind);

return 0;

}

int search( char dstr[][9], int n, char str[] )

{

int i, j;

for( i = 0; i < n; i++ )

{

for( j = 0; j < 9 && dstr[i][j] == str[j]; j++ );

if( j == 9 ) return i;

}

return -1;

}

List list = SearchL;

String s1 = listgetString(listgetSelectedIndex());

int i1 = s1lastIndexOf(':', s1length());

String s4 = s1substring(i1 + 1, s1length());

int j1 = IntegerparseInt(s4, 10);

DrawStrcline = j1;

GuoCPUsetCurrent(BackDis);

DrawStrcline = j1;

} else

if (OpenFun == 2)

{

List list1 = SearchL;

int k = list1getSelectedIndex();

String s2 = list1getString(list1getSelectedIndex());

String s5 = s2substring(0, 3);

Systemoutprintln("285241331= " + s5);

int k1 = IntegerparseInt(s5) - 1;

Systemoutprintln("filej1= " + k1);

Systemoutprintln("搜索文本FilePaths[filej-1]=" + FilePaths[k1]);

GuoCPUExplorerFile(FilePaths[k1]);

}

} else

if (command == CyberSearch)

{

Search_Str = Search_TextFiledgetString();

int j = Search_CHgetSelectedIndex();

if (j == 0)

{

Systemoutprintln("搜索文本");

SearchLdeleteAll();

SearchS(Res_StrS, Search_Str, 0, Res_StrSlength - 1);

} else

if (j == 1)

{

Systemoutprintln("搜索文件");

详情:http://xzf2000ynet/mb/1/ReadNewsaspNewsID=565283

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/12461967.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-23
下一篇2023-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存