c语言函数简单题 c语言考试常用函数-成都创新互联网站建设

关于创新互联

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

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

c语言函数简单题 c语言考试常用函数

一个简单的C语言函数题

#includestdio.h

网站的建设创新互联专注网站定制,经验丰富,不做模板,主营网站定制开发.小程序定制开发,H5页面制作!给你焕然一新的设计体验!已为自上料搅拌车等企业提供专业服务。

#define STUDENT 10

#define CLASS 5

int student_i=0,class_i=0;

main()

{

void average(int course[STUDENT][CLASS], float aver[CLASS]);

void highest(int course[STUDENT][CLASS]);

int course[STUDENT][CLASS] = {{38, 45, 52, 70, 88}, {47, 58, 19, 65, 48},

{80, 19, 64, 5, 47}, {81, 69, 9, 43, 88}, {10, 96, 28, 90, 33},

{4, 88, 22, 43, 32}, {17, 94, 70, 67, 19}, {27, 82, 86, 67, 98},

{34, 4, 92, 15, 84}, {57, 9, 66, 76, 65}};

float aver[CLASS]={0};

average(course, aver);

highest(course);

}

void average(int course[STUDENT][CLASS], float aver[CLASS])

{

int i,j;

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

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

aver[i]+=course[j][i];

printf("每一门课程的平均分:\n");

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

printf("%5.2f\n",aver[i]/=10);

printf("\n");

}

void highest(int course[STUDENT][CLASS])

{

int i,j;

int highest;

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

{

highest=course[0][i];

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

if(course[j][i]highest)

{highest=course[j][i];

student_i=j;

class_i=i;}

printf("第%d门课程分神伏数最高的学生及其课程:第%d名学生胡扰的第%d门课程分数为%d\n",i+1,student_i+1, class_i+1,highest);

}

}

你看看行不裤瞎旦行

求高手解答一些简单的C语言题目!(高分悬赏)

1、

Before GlobalPlusPlus(), it is 1

Before ++, it is 1

After ++, it is 2

After GlobalPlusPlus(), it is 2

2、

over!

3、

(1)

printf("Input a year:");

scanf("%d",year);

(2)

(0==year%4 0!=year%100) || 0==year%400

4、

(1)

s[i]!='\0'

(2)

s[j]=s[i];

5、

#includestdio.h

main()

{

int i=1,j=1;

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

{

for(j=1;j=9;j++)

{

if(j=i)

{

printf("%2d*%2d=%2d",i,j,i*j);

}

else

{

printf(" ");

}

}

printf("\n");

}

}

6、

#includestdio.h

main()

{

int i=1;

long sum=0;

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

{

sum += i;

}

printf("1~100的累加和为:%ld\n",sum);

}

7、

#includestdio.h

void GetMaxMin(float s[])

{

int i,max,min;

min=0;/*假设第一是最小的*/

max=0;/*假设第一是最大的*/

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

{

if(s[min]s[i])

{

min=i; /*有比当记录还小的就记录下他的下标*/

}

if(s[max]s[i])

{

max=i; /*有比当记录还大的就记录下他的下标*/

}

}

printf("数组的最小值:%.2f\n数组的最大值%.2f\n",s[min],s[max]);

}

main()

{

int i;

float s[10];

printf("求数组中最小最小值\n\n");

printf("请输入10个数:\n");

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

scanf("%f",s[i]);

GetMaxMin(s);

}

8、怎么有是乘法让败表呀,上面有个上三角,这里就弄个下三角!

#includestdio.h

main()

{

int i=1,j=1;

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

{

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

{

printf("%2d*%2d=%2d",j,i,i*j);

}

printf("\n");

}

}

9、

#include stdio.h

#include math.h

#define TRUE 1

#define FAULSE 0

/*isprime 的返回值为激没0,n不是素数;返回值为1,n是素数。*/

int isprime(int n)

{

int i;

if(2==n)

{

return TRUE;

}

if(0==n%2)

{

return FAULSE;

}

for(i=3;i=sqrt(n);i+=2)

{

if(n%i==0)

{

return FAULSE;

}

else if(isqrt(n))

{

return TRUE;

}

}

}

void main()

{

int number=0;

do{

printf("请一个大明滑纳于1正整数:");

fflush(stdin);

scanf("%d",number);

}while(number2);

if(isprime(number))

printf("%d是一个素数!\n",number);

else printf("%d不是一个素数!\n",number);

}

10、

#include stdio.h

long fac(int n)

{

if(0==n || 1==n)

return 1;

else return n*fac(n-1);

}

void main()

{

int m=-1,k=-1;

do{

printf("请一个非负整数m:");

fflush(stdin);

scanf("%d",m);

}while(m0);

do{

printf("请一个不大于%d的非负整数k:",m);

fflush(stdin);

scanf("%d",k);

}while(k0);

printf("%ld\n",fac(k)/fac(m-k));

}

11、

#include stdio.h

void main()

{

char ch;

int letter=0,integer=0,space=0,other=0;

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

while((ch=getchar()) !=10)

{

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

letter++;

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

integer++;

else if(ch==32 || ch==9)

space++;

else other++;

}

printf("英语字符:%d\n",letter);

printf("数字字符:%d\n",integer);

printf("空格字符:%d\n",space);

printf("其他字符:%d\n",other);

}


网页题目:c语言函数简单题 c语言考试常用函数
分享URL:http://kswsj.cn/article/dsppscd.html

其他资讯