网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

请补充函数proc(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。

例如,str1=”I am a”,str2=”student”,结果输出:I am a student。

注意:部分源程序给出如下。

请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。

试题程序:


参考答案

更多 “ 请补充函数proc(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。例如,str1=”I am a”,str2=”student”,结果输出:I am a student。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序: ” 相关考题
考题 请补充main函数,该函数的功能是:从一个字符串中截取前面若干个给定长度的子字符串。其中,str1指向原字符串,截取后的字符存放在str2所指的字符数组中,n中存放需截取的字符个数。例如:当str1=“cdefghij”,然后输入4,则str2=“cdef”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define LEN 80main(){char str1[LEN),str2[LEN);int n,i;clrscr();printf(“Enter the string:\n”);gets(str1);printf“Enter the position of the stringdeleted:”);scanf(【 】);for(i=0;i<n;i++)【 】str2[i]=‘\0’;printf(“The new string is:%s\n”,【 】);}

考题 阅读下列函数说明和C函数,将应填入(n)处的字句写在对应栏内。[函数2.1说明]函数strcpy的功能是将字符串str2的内容复制到字符申str1。[函数2.1](1) strcpy (char *slr1, const char *str2){ char * temp;while( * str2!='\0') *cp++ =(2);(3)='\0';return str1;}[函数2.2说明]函数int strcmp(const char *str1, const char *str2)的功能是按字典序比较两个字符串str1和str2的大小。当str1<str2时返回-1,当str1>str2时返回1,否则返回0。[函数2.2]int strcmp(const char *str1, const char *str2){ while( *str1= =* str2) {if(* s1= =(4)) return 0;s1++;(5);}if( *str1<*str2) return -1;return 1;}

考题 请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。例如:str1=“How do”,str2=“you do?”,结果输出: How do you do?注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 40void fun(char*str1,char *str2){int i=0;char *pl=str1;char*p2=str2;while(【 】)i++;for(;【 】;i++)*(p1+i)=【 】;*(p1+i)='\0';}main(){char str1[N],str2[N);clrscr();printf("*****Input the string str1 Str2*****\n");printf("\nstr1:");gets(str1);printf("\nstr2:");gets(str2);printf("**The string str1 str2**\n");puts(str1);puts(str2);fun(str1,str2);printf("*****The new string *****\n");puts(str1);}

考题 请补充main函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1=“cdefghij”,则 str2=“cegi”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define LEN 80main(){char str1[LEN],str2 [LEN];char *p1=str1,*p2=str2;int i=0,j=0;clrscr();printf("Enter the string:\n");scanf(【 】);printf("***the origial string***\n");while(*(p1+j)){printf("【 】",*(p1+j));j++;}for(i=0;i<j;i+=2)*p2++=*(str1+i);*p2='\0';printf("\nThe new string is:%s\n", 【 】 );}

考题 请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2倒置后接在字符串str1后面。例如:str1=“How do”,str2=“?od uoy”,结果输出:“How do you do?”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 40void fun(char *str1,char *str2){int i=0,j=0,k=0,n;char ch;char *p1=str1;char *p2=str2;while(*(p1+i))i++;while(*(p2+j))j++;n=【 】;for(;k=j/2;k++,j--){ch=*(p2+k);*(p2+k)=*(p2+j);*(p2+j)=ch;}【 】;for(;【 】;i++)*(p1+i)=*p2++;*(p1+i)='\0';}main(){char str1[N],str2[N];int m,n,k;clrscr();printf("***Input the string str1 str2***\n");printf("\nstr1:");gets(str1);printf("\nstr2:");gets(str2);printf("***The string str1 str2 ***\n");puts(str1);puts(str2);fun(str1,str2);printf("*** The new string ***\n");puts (str1);}

考题 请补充函数proc(),该函数的功能是:把字符串str中的字符按字符的ASCⅡ码升序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传人。例如,如果输入“9fedcba”,则输出为“abcdefg”。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序:

考题 字符串函数strcat(str1,str2)的作用是将字符串str2连接在字符串str1后.

考题 函数strcpy(str1,str2)是将字符串 str2 连接到字符串 str1之后。

考题 字符串函数strcat(str1,str2)的作用是将字符串str2连接在字符串str1后。