第2题
例如,输入:-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(【 】);
}
第3题
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
第4题
例如,输入308*28,结果为8624.000000。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
include<stdio, h>
main ( )
{
int a=0, b=0, flag=l, fg=l;
float result;
char *p, ch;
char str[10];
clrscr ();
printf("\n Input a string \n");
gets (str);
p=str;
while (*p)
{
if (*p>='0' &&*p<='9' && flag==l )
a=【 】;
else
if (fg)
{
ch=*p;
flag=2;
fg=0;
}
if (*p>='0 ' &&*p<='9' &&flag==2)
b=【 】;
p++;
}
switch(【 】)
{
case '+': result=a+b;break;
case '-': result=a-b;break;
case '*' :result=a*b;break;
case '/' :result= (float) a/b;break;
printf ("\nresult=%f", result);
}
第5题
例如,输入1,2,3,5,4,0时,最大的数为5。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写出的若干表达式或语句。
试题程序:
include<stdio.h>
include<conio.h>
define N 100
main()
{
int num[N];
int i=-1;
int max=0;
clrscr();
printf("\nInput integer number:\n");
do
{
i++;
printf("num[%d]=",i);
scanf("%d",【 】);
max=【 】num[i]:max;
}while (【 】);
printf("max=%dkn",max);
}
第6题
例如,当arr[8]={13,1,205,252,2,333,4444,21)时实际输人时,数与数之间用Enter键分开,bb[4]={252,333,4444)。
注意:部分源程序给出如下。
请勿改动函数main()和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
第7题
请编码实现动物世界的继承关系,要求:
(1)父类动物类(Animal)具有属性:name;行为:吃饭(eat)、睡觉(sleep)
(2)子类为兔子类(Rabbit)
(3)不同的动物吃的行为各不相同(兔子吃草);但睡觉的行为是一致的。
(4)通过继承实现以上需求,并编写测试类AnimalTest进行测试。
第8题
例如,输入: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);
}
第10题
Private Sub Command1_Click()
Dim x As Integer
x=InputBox( “ 请输入一个正整数 ” )
While x>_ _[11] ___
Print x Mod 10;
x=x\10
Wend
Print__ [12] __
End Sub
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!