请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组中,当桉回车键时结束输入,最后输出这个字符数组中的所有字符。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<ctype.h>main(){int i=0;char a [81];char *p=s;clrscr ();printf{" Input a string \n");for (i=0; i<80; i++){s [i] =getchar ( );if (s [i]=='\n')【 】;}s[i]=【 】printf(" display the string \n");while (*p)putchar (【 】);}

请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组中,当桉回车键时结束输入,最后输出这个字符数组中的所有字符。

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

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

试题程序:

include<stdio.h>

include<ctype.h>

main()

{

int i=0;

char a [81];

char *p=s;

clrscr ();

printf{" Input a string \n");

for (i=0; i<80; i++)

{

s [i] =getchar ( );

if (s [i]=='\n')

【 】;

}

s[i]=【 】

printf(" display the string \n");

while (*p)

putchar (【 】);

}


相关考题:

请补充main函数,该函数的功能是:从键盘输入一个字符串及一个指定字符,然后把这个字符及其后面的所有字符全部删除。结果仍然保存在原串中。 例如,输入“abcdefg”,指定字符为“d”,则输出“abe”。 注意:部分源程序给出如下。 请勿改动main函数和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。 试题程序: includestdlib.h includestdio.h define M 80 void main { int i=0; char str[M]; char ch; system("CLS"); printf("\n Input a strin9:\n"); gets(str); printf("\n Input a charator;\n"); scanf("%c",&ch); while(str[i]!=\0) { if(str[i]==ch) 【1】 【2】 ; } str[i]=【3】 ; printf("\n***display string***\n"); puts(str); }

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80int fun (char s[],char ch){int i=0, n=0;while(【 】){if(【 】)n++;i++;}【 】;}main ( ){int n;char str[N], ch;clrscr ();printf ("\nInput a string: \n");gets (str);printf ("\nInput a charactor: \n" ;scanf ("%c", ch);n=fun (str, ch);printf("\nnumber of %c:%d", ch, n);}

请补充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++;}}

请补充函数fun(),该函数的功能是;删除字符数组中小于等于指定字符的字符,指定字符从键盘输入,结果仍保存例如,输入“abcdefghij”,指定字符为‘d’,则结果输出“defghij”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio. h>define N 80void fun (char s[], char ch){int i=0, j=0;while (s [i] ){if (s Iii<ch)【 】;else{【 】i++;}}【 】}main (){char str [N], ch;clrscr ();printf("\n Input a string:\n");gets (str);printf("\n*** original string ***\n");puts (str);printf("\n Input a character:\n");scanf ("%c", ch);fun(str, ch);printf("\n*** new string ***\n");puts (str);}

请补充main()函数,该函数的功能是:把一个二维字符数组每行字符串中最大的字符复制到字符数组s中。例如,如果arr[3]={″hoih″,″yufui″,″xgf″),则str=″oyx″。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填人所编写的若干表达式或语句。试题程序:

请补充函数proc(),该函数的功能是:删除字符数组中小于指定字符的字符,指定字符从键盘输入,结果仍保存在原数组中。 例如,输人“abcdefghij”,指定字符为“f”,则结果输出“fghij”。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。 试题程序:

从键盘输入一组小写字母,保存在字符数组str中。请补充函数proc(),该函数的功能是:把字符数组str中字符下标为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。例如,输入abcdefg,输出aBcDeFg。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proe()的横线上填入所编写的若干表达式或语句。试题程序:

请补充main()函数,该函数的功能是:从键盘输人一个字符串及一个指定字符,然后把这个字符及其后面的所有字符全部删除。结果仍然保存在原串中。 例如,输人“abcdefg”,指定字符为“d”,则输出“abe”。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填入所编写的若干表达式或语句。 试题程序:

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