题目详情
当前位置:首页 > 计算机考试 > 软件测试工程师
题目详情:
发布时间:2023-10-22 04:10:54

[简答题]
以下是某C语言程序,用来求一个数的绝对值,请仔细阅读程序并完成要求。
#include " stdio.H"
main( )
{
float x, y;
scanf(" %f ", &x);
if(x>0)
y=x;
else
y=-x;
printf(" % f", y);
getch( );
}
画出此程序主函数的控制流程图。

更多"以下是某C语言程序,用来求一个数的绝对值,请仔细阅读程序并完成要求。 "的相关试题:

[简答题]
以下是某C语言程序,用来求一个数的绝对值,请仔细阅读程序并完成要求。
#include " stdio.H"
main( )
{
float x, y;
scanf(" %f ", &x);
if(x>0)
y=x;
else
y=-x;
printf(" % f", y);
getch( );
}
设计一组测试用例,使该程序所有函数的语句覆盖率和分支覆盖率均能达到100%。如果为该程序的语句或分支覆盖率无法达到100%,需说明为什么。

[简答题]以下是某C语言程序,用来求一个数的绝对值,请仔细阅读程序并完成要求。
#include"stdi.h"
main( )

float x,y;
scanf("%f",&x);
if(x>0)
y=x;
else
y=-x;
printf("%f",y);
getch( );

画出此程序主函数的控制流程图。
[简答题]以下是某C程序,用来求一个数的绝对值,请仔细阅读程序并完成要求。
#include "stdio.h"
main( )

float x,y;
scanf("%f",&x);
if (x>0)
y=x;
else
y=-x;
printf ("%f",y);
getch( );

画出此程序主函数的控制流程图。
[简答题]
以下是某C程序段,其功能为计算输入数字的阶乘。请仔细阅读程序并完成要求。
#include<stdio. h>
#include<stdlib. h>
int main( )
{
int i=0;/*i为计数器*/
int n;
int factorial=1;/*保存阶乘的结果*/
puts("*************************************"):
puts("*The program will compute *");
puts("*the factotial of an integer *");
puts("*************************************"):
puts("please input the number n:");
scanf("%d",&n);
if(n<0)/*判断输入的数是否大于或等于0*/
{
printf("please input an interger>=0. /n");
return 0;
}
if(n==0)/*0的阶乘是1*/
{
printf("factorial of 0 is 1./n");
return 0;
}
i=1;
while(i<=n)
{
factorial = factorial * i;
i++:
}
printf("factorial of % d is:%d. /n",n,factorial);
getch( );
return 0:
}
画出此程序主函数的控制流程图。

[简答题]以下是某C程序段,其功能为计算输入数字的阶乘。请仔细阅读程序并完成要求。
#include
#include
int main( )

int i = 0;/* i为计数器 */
int n;
int factorial = 1;/* 保存阶乘的结果 */
puts("*************************************");
puts("* The program will compute *");
puts("* the factotial of an integer *");
puts("*************************************");
puts("please input the number n:");
scanf("%d",&n);
if(n < 0)/*判断输入的数是否大于或等于0*/

printf("please input an interger >= 0./n");
return 0;

if(n==0)/* 0的阶乘是1 */

printf("factorial of 0 is 1./n");
return 0;

i = 1;
while(i <= n)

factorial = factorial * i;
i++;

printf("factorial of %d is:%d./n",n,factorial);
getch( );
return 0;

画出此程序主函数的控制流程图。
[简答题]以下是某C程序段,其功能为计算输入数字的阶乘。请仔细阅读程序并完成要求。
#include<stdio.h>
#include<stdlib.h>
int main( )

int i=0;/*i为计数器*/
int n;
int factorial=1;/*保存阶乘的结果*/
puts("*****************************************");
puts("*The program will compute*");
puts("*the factotial of an integer*");
puts("*****************************************");
puts("please input the number n:");
scanf("%d", &n);
if(n<0)/*判断输入的数是否大于或等于0*/

printf("please input an interger>=0./n");
return 0;

if(n==0)/*0的阶乘是1*/

printf("factorial of 0 is 1./n");
return 0;

i=1;
while(i<=n)

factorial= factorial * i;
i++;

printf("factorial of %d is: %d./n", n, factorial);
getch( );
return 0;

画出此程序主函数的控制流程图。
[简答题]以下是某C程序段,其功能是计算输入数据是否为水仙花数,请仔细阅读程序并完成要求。
#include
void main( )

int i,a,b,c;
scanf("%d ",&i);
a=i/100;
b=i/10%10;
c=i%10;
if(i==a*a*a+b*b*b+c*c*c)
printf("%d/n",i);

画出此程序主函数的控制流程图。
[填空题]阅读程序:
# include<string.h>
# include<strdio.h>
strle(char a[],char b[])
int num=0,n=0;
while(*(a+num)!=’0’)num+ +;
while(b[n])
* (a+num)=b[n];num+ +;n+ +;
return(num);

main( )
char strl[81],str2[81],* p1=strl,*p2=str2;
gets(p1);gets(p2);
prinf("%d/n",strle(p1,p2));

运行上面的程序,如果从键盘上输入字符串qwerty和字符串abcd,则程序的输出结果是 【14】
[单项选择]请阅读程序:
#include<math.h>
#include<stdio.h>
main( )
float a,b,c;
scanf("%f%f",&a,&b);
c=a/b;
while(1)

if(fabs(c)>1.6)

a=b;
b=c;
c=a/b;

else break;

printf("%f/n",b);

若运行时从键盘上输入3.6 2.4<回车>,则输出结果是______。
A. 1.500000
B. 1.600000
C. 2.000000
D. 2.400000
[简答题]下面是一段C程序,其功能为计算1到所输入数值的逐步累加和,请阅读程序并完成要求。
#include<stdio.h>
int sum(int);
void main( )

int num,k;
printf("Enter a number:");
seanf("%d",&num);
for(k=1;k<=num;k++)
printf("1 to %d is %d/n",k,sum(k));

int sum(int n)

int i,result=0;
for(i=1;i<=n;i++)
result+=i;
return result;

设计一组测试用例,使该程序所有函数的语句覆盖率和分支覆盖率均能达到100%。如果认为该程序的语句或分支覆盖率无法达到100%,说明原因。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码