程序改错题(2)

2018-11-21 15:31

while(*str!='\\0')

{if(*str<='0'&&*str>='9') (*num)++; str++;} }

23.

函数str_space()的功能是统计数组中大于90小于100的数字的个数。 str_space(int *str,int *num) { *num=0;

while(*str!='\\0')

{if(*str<=90&&*str>=100) (*num)++; str++; } }

main()

{int a[100]={78,98,57,75,68,41,91,90,45},*s=a; int k=0,*p=&k; str_space(s,p); printf(\ }

24.

用指针法实现两个整数的交换。 void fun (int *a, int *b) {

int t; t=*a; *a=*b; *b=t; }

main() {

int a,b;

printf(\ scanf(\ fun(a,b);

printf(\}

25.

把两个数按由大到小的顺序输出来。 swap( int *p1,int *p2) {int p; p=*p1; *p1=*p2;

*p2=p; }

main( )

{ int a,b, *p1,*p2; printf(\scanf(\p1=&a,p2=&b; if(a

swap(a,b);

printf(\

printf(\}

26.

在一个一维整型数组中找出其中最大的数及其下标。 #define N 10

int fun(int *a,int *b,int n) { int *c,max=*a;

for(c=a+1;c

return max; }

27.

函数my_cmp()的功能是比较字符串s和t的大小,当s等于t时返回0,否则返回s和t的第一个不同的字符的ASCII码差值,即当s>t时返回正值,当s

if(*s=?\\0?) return 0; s++; t++; }

return(*s-*t); }

28.

函数fun的功能是计算 1+1/2+1/3+…+1/m。 double fun(int m) { double t=1.0; int i;

for(i=2;i<=m;i++)

t+=1/i; return t; }

main() { int m;

scanf(\

printf(\}

29.

将数组逆序输出。 #define N 11 main()

{ int i,j,t,number;

int a[N]={1,2,4,6,8,9,12,15,149,156}; for(i=N-1;i>=0;i++) printf(\ printf(\}

30.

下列函数的功能是实现大写字母转换成小写字母。 #include char fun(char *c)

{ if(*c<='Z'||*c>='A')

*c-='A'-'a'; return *c; }

31.

下列程序的功能是输出结构体变量的值。 student struct { long int num; char name[10];

char sex;}a={89241,\main()

{ printf(\32.

下列程序的功能是输出结构体变量的值。 #include \main()

{ staff struct { int num;

char name[100];

int age;}person,*p; p=&person;

person.num=100;

strcpy(person.name,\person.age=33;

printf(\}

33.

下列程序的功能是输出结构体变量的值。 #include \main()

{ farmer struct { int num;

char name[100];

int age;}person,*p; p=&person;

person.num=50;

strcpy(person.name,\person.age=40;

printf(\}

34.输出运行结果。 #include %union un { int i;

char c[2];}; main()

{ union x; x.i=8;

x.c[0]=10;

printf(\}

35.

输出学号、姓名、语文分数的值。 student struct { int num,age;

char name[20],sex,addr[30]; struct

{float chinese,math,physics,english; }score; };

main() {struct student a={2014102,20,\Bo\

printf(\ } 36.

输出程序运行结果。

#include struct STU {

char name[10]; int num; };

main()

{ struct STU s[2]={{\p=s; p++;

printf(\} 37.

下列程序的功能是输出结构体变量的值。 #include \main()

{ worker struct { int num;

char name[20];

int age;}person={80,\ p=&person;

printf(\}

38.

输出结构体变量的值。 #include \main()

{ struct worker { int num;

char name[20];

int ge;}person={100,\p=&person;

printf(\}

39.

下列程序的功能是输出结构体变量的值。 struct student { long int num; char name[10]; char sex;}; main()

{ struct a={89241,\

printf(\}

40.下列函数的功能是统计不带头结点链表的结点数。 #include struct node { int data;

struct node *next;}; count(struct node *head) { int n;

while(head!=NULL) { n++;

head=head->next; }

return n; }


程序改错题(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:CSC公派留学出国研修计划中文版

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: