c语言源代码统计函数个数 c语言数据统计-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

c语言源代码统计函数个数 c语言数据统计

C语言编写函数,统计字符串中数字字符的个数

#includestdio.h

创新互联公司专注于企业营销型网站建设、网站重做改版、洪江网站定制设计、自适应品牌网站建设、H5场景定制商城建设、集团公司官网建设、成都外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为洪江等各大城市提供网站开发制作服务。

#includestring.h

main()

{

int i,j=0,k;

char a[1000];//长度自己根据实际情况调整

printf("请输入一串字符串:\n");

gets(a);

k=strlen(a);

for(i=0;ik;i++)

if('0'=a[i]='9')

j++;

printf("这串字符串中数字字符有%d个!\n",j);

}

C语言程序:编写程序,统计特定字母的个数。要求用指针编写。谢谢!!!

#include "stdio.h"

#include "stdlib.h"

int getCharCount(char *sz,char ch,int len)

{

int i = 0;

int icount =0;

for(i=0;ilen,i++)

{

if(*sz == ch)

icount = icount +1;

sz++;

}

return icount;

}

void main()

{

char sz[10]={'a','b','c','a','a','d','b','a','c','a'};

int iCnt=0;

iCnt = getCharCount(sz,'a',10);

printf("a 的个数为 %d",iCnt);

getche();

}

输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数.(C语言)

输入一行字符分别统计,出其中英文字母空格数字和其他字符的个数的源代码如下:

#includestdio.h

int main()

{

char c;

int letters=0,spaces=0,digits=0,others=0;

printf("请输入一些字母:\n");

while((c=getchar())!='\n')

{

if((c='a'c='z')||(c='A'c='Z'))

letters++;

else if(c='0'c='9')

digits++;

else if(c==' ')

spaces++;

else

others++;

}

printf("字母=%d,数字=%d,空格=%d,其他=%d\n",letters,digits,spaces,others);

return 0;

}

扩展资料

C语言程序统计一个文件的字符数的源代码如下

#include stdio.h

#include stdlib.h

int main(void)

{

int counter = 0; //计数器

int ch; //存储从文件中读入的字符

while( EOF != (ch = getchar()) ) //使用getchar函数从标准输入中读取字符,当读取到末尾时停止循环

{

counter++; //计数器自增

}

printf("%d", counter);

return 0;

}


分享标题:c语言源代码统计函数个数 c语言数据统计
文章出自:http://kswsj.cn/article/ddgsoeg.html

其他资讯