请补充main函数,该函数的功能是:从键盘输入一组字符串,以‘*’结束输入,并显示出这个字符串。例如,输入abcdefghi*,结果显示adcdefghi。注意:部分源程序给出如下.请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。试题程序:include<stdio. h>define N 80main (){iht i=-l, j=0;char str IN];clrscr ();printf("\n Input a string \n");do{i++;scanf(【 】);}while(【 】);printf ("\n**display the string** \n");while (j<i){printf (【 】);j++;}}

请补充main函数,该函数的功能是:从键盘输入一组字符串,以‘*’结束输入,并显示出这个字符串。

例如,输入abcdefghi*,结果显示adcdefghi。

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

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

试题程序:

include<stdio. h>

define N 80

main ()

{

iht i=-l, j=0;

char str IN];

clrscr ();

printf("\n Input a string \n");

do

{

i++;

scanf(【 】);

}while(【 】);

printf ("\n**display the string** \n");

while (j<i)

{

printf (【 】);

j++;

}

}


相关考题:

请补充main函数,该函数的功能是:从键盘输入一个长整数,如果这个数是负数,则取它的绝对值,并显示出来。例如,输入:-3847652,结果为:3847652。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>main(){long int n;clrscr();printf("Enter the data;\n");scanf(【 】);printf("*** the absolute value ***\n");if(n<0)【 】printf("\n\n");printf(【 】);}

请补充函数fun(),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。例如,输入“abcdef”,输出“bdf”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80void fun(char s[],int n){int i, j;j=0;for(i=0;【 】;i++){if(【 】)s [j++]-s [i];}【 】;}main ( ){int i=0, strlen=0;char str [N];clrscr ();printf ("\nInput a string: \n");gets (str);while (str [i] !='\0'){strlen++;i++;}fun(str, strlen);printf("\n*** display string ***\n");puts (str);}

请补充函数fun(),该函数的功能是:把ASCⅡ码为偶数的字符从字符串s打中删除,结果仍然保存在字符串srt中,字符串str从键盘输入,其长度作为参数传入函数fun()。例如,输入“abcdef”,输出“ace”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:inc lude< stdio, h>define N 80【 】{int i, j;【 】for (i=0;i<n;i++){if (s [i] %2!=0)s [j++]=s [i];}【 】;}main ( ){int i=0, strlen=0;char str[N];clrscr ();printf ("\nInput a string:\n");gets (str);while (str [i] !=' \0' ){strlen++;i++;}fun (str, strlen);printf("\n*** display string ***\n");puts (str);}

请补充函数fun(),该函数的功能是:把字符下标能铍2或3整除的字符从字符串str中删除,把剩余的字符重新保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。例如,输入“abcdefghijk”,输出“bfh”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80void fun(char s[], int n){int i, k;【 】;for(i=0; i<n; i++){s[k++]=s[i];if(【 】)k--;}【 】;}main(){int i=0,strlen=0;char str[N];clrscr();printf("\nInput a string:\n");gets(str);while(str[i]!='\0'){strlen++;i++;}fun(str,strlen);printf('\n*** display string ***\n");puts(str);}

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存在字符串str中,字符串str从键盘输人,其长度作为参数传人fun()函数。例如,输入“abcdef”,则输出“bdf”。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在mare()函数的横线上填入所编写的若干表达式或语句。试题程序:

请补充函数proc(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。例如,str1=”I am a”,str2=”student”,结果输出:I am a student。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。试题程序:

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

请编写函数con(char s1[ ], char s2[ ]),其功能是实现两个字符串的连接(不能使用库函数strcat), 即把字符数组s2中的字符串连接到字符数组s1字符串的后面。 例如main函数中输入"hello",“world”,则最后输出``“helloworld” ;

请编写函数cpy(char s1[ ], char s2[ ]),其功能是实现字符串的复制(不能使用库函数strcpy), 即把字符数组s2中的字符串复制到字符数组s1中。 例如main函数中输入"hello",“world”,则最后输出``world” ;