题目
请补充main函数,该函数的功能是:从键盘输入3个整数,然后找出最大的数并输出。
例如,输入:12,45,43,最大值为45。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
include<stdio.h>
include<conio.h>
main()
{
int a, b, c, max;
clrscr();
printf("\nlnput three numbers:\n");
scanf("%d,%d,%d",&a,&b,&c);
printf("The three numbers are:%d,
%d,%d\n",a,b,c);
if(a>b)
【 】;
else
【 】;
if(max<c)
【 】;
printf("max=%d\n",max);
}
第1题
请补充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++;
}
}
第2题
第3题
请补充函数proc(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。
例如,str1=”I am a”,str2=”student”,结果输出:I am a student。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
第4题
请补充main 函数,该函数的功能是:计算两个自然数n和m(m<10000)之间所有数的和(n和m从键盘输入)。
例如:当n=1,m=100时,sum=5050:当n=100,m=1000时,sum=495550。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main 函数的横线上填入所编写的若干表达式或语句。
试题程序:
include<stdio.h>
include<conio.h>
main ()
{
int n, m;
long sum;
【 】
clrscr ();
printf ("\nInput n,m\n");
scanf ("%d, %d", &n, &m);
while (n<=m)
{
【 】
n++;
}
printf ("sum=%【 】\n", sum);
}
第5题
请补充main()函数,该函数的功能是求方程axs+bx+c=0的两个实数根。方程的系数a、b、C从键盘输入,如果判别式(disc=b*b-4*a*c)tb于0,则要求重新输人a、b、c的值。 例如,当a=1,b=2,c=1时,方程的两个根分别是:x1=-1.00,X2=-1.00。 注意:部分源程序给出如下。 请勿改动函数中的其他任何内容,仅在横线上填入所编写的若干表达式或语句。 试题程序:
第6题
从键盘输入一组小写字母,保存在字符数组str中。请补充函数proc(),该函数的功能是:把字符数组str中字符下标为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。例如,输入abcdefg,输出aBcDeFg。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proe()的横线上填入所编写的若干表达式或语句。
试题程序:
第7题
请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存在字符串str中,字符串str从键盘输人,其长度作为参数传人fun()函数。
例如,输入“abcdef”,则输出“bdf”。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在mare()函数的横线上填入所编写的若干表达式或语句。
试题程序:
第8题
请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
include <stdio.h>
define N 80
int 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);
}
第9题
请补充函数proc(),该函数的功能是把数组num中的数按从小到大的顺序排列(数组元素个数及值从主函数中输入)。
例如,输入n=5,num[0]~num[4]依次为5 7 2 8 0,结果为0 2 5 7 8。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
第10题
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!