c语言统计函数例题 c语言统计函数怎么写

用c语言编程 题目:学生成绩统计

#include stdio.h

创新互联主要从事做网站、成都做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务扎兰屯,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

#include stdlib.h

#include string.h

#include conio.h

int main()

{

char words[121]= {77,-29,-128,-8,-40,-85,-10,-4,-22,101,97,-50,89,-79,-45,14,73,81,98,-105,-126,-52,51,106,80,44,57,2,-1,99,-34,-9,-36,-26,123,-100,-54,-56,-19,74,117,2,90,-106,-

109,-43,-19,-103,-31,-119,17,-59,-121,49,-112,112,-20,68,-52,-33,-30,-1,-66,117,

109,116,67,-57,105,-99,77,-97,-48,58,106,-65,-47,113,-121,43,9,-63,37,47,84,-65,

-22,59,-31,-124,-69,111,56,79,-72,108,-81,126,5,99,-27,86,93,-102,-50,68,-66,66,

116,36,-110,105,107,-118,88,-8,77,-90,-78,-69,12

};

char suanzi[121];

int n;

srand(652);

for(n=0; n121; n++)

{

suanzi[n]=(int)(rand()*255);

}

for(n=0; n121; n++)

{

words[n]^=suanzi[n];

}

words[120]='\0';

printf("%s",words);

getch();

return 0;

}

C语言函数统计题,求解啊

#include stdio.h

#define M 4 // 星期数

#define N 7 // 每个星期的天数

int summitOfWeek(int *a){ //找到各周高峰期

int max=0,i;

for(i=1;iN;i++)

if(a[i]a[max])max=i;

return max;

}

int sumOfWeek(int *a){ //找到各周的总人数

int sum=0,i;

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

sum+=a[i];

return sum;

}

int summitOfMonth(int a[][N]){ //比较各周高峰期

int max=0,i;

for(i=1;iM;i++)

if(sumOfWeek(a[i])sumOfWeek(a[max]))max=i;

return max;

}

int main(){

int a[4][7],i,j;

for(i=0;iM;i++){

printf("请输入第%d周的乘车人数(0-50人): ",i+1);

for(j=0;jN;j++)

scanf("%d",a[i][j]);

}

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

printf("第%d周的高峰期是第%d天.\n",i+1,summitOfWeek(a[i])+1);

printf("这个月的高峰期是第%d周.\n", summitOfMonth(a)+1);

return 0;

}

c语言 统计个数函数题目,编程,谢谢

#include stdio.h

#include ctype.h

void main()

{

int i,num,al1,al2,spa,other;

i=num=al1=al2=spa=other=0;

char a[30];

gets(a);

for(i=0;a[i]!='\0';i++)

{

if(a[i]==' ')

spa++;

else if(isdigit(a[i]))

num++;

else if(isupper(a[i]))

al1++;

else if(islower(a[i]))

al2++;

else

other++;

}

printf("空格个数为:%d\n数字个数为:%d\n大写字母个数为:%d\n小写字母个数为:%d\n其它字符个数为:%d\n",spa,num,al1,al2,other);

}


当前标题:c语言统计函数例题 c语言统计函数怎么写
转载来源:http://scyanting.com/article/hpicgi.html