简答题:下列给定程序中,函数proc()的功能是:根据输入的3个边长(整型值),判断能否构成三角形:若能构成等边三角形,则返回3

  • 题目分类:C语言
  • 题目类型:简答题
  • 查看权限:VIP
题目内容:
下列给定程序中,函数proc()的功能是:根据输入的3个边长(整型值),判断能否构成三角形:若能构成等边三角形,则返回3;若是等腰三角形,则返回2;若能构成三角形则返回1;若不能,则返回0。
例如,输入3个边长为3。4,5.实际输入时,数与数之间以Enter键分隔而不足逗号。
请修改程序中的错误.使它能得出正确的结果。
注意:不要改动main()函数。不得增行或删行.也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<math.h>
int proc(int a.int b.int c)
{
if(a+b>c&&h+c>a&&a+c>b)
{
if(a==b&&b==c)
//****found****
return 1;
else if(a==b||b==e||a==c)
return 2:
f|****found****
else return 3:
}
else return 0:
}
void main()
(
int a,b,C,shape;
printf(”\nfnput a,b,e:”);
scanf(”%d%d%d”,&.a&.b,&c);
printl'(”na=%d,b-%d,e=%d\n”,a,b,c);
shape=proc(a,b,c);
printl.(”\n\nThe shape:%d\n”,shape);
}
参考答案:
答案解析:

学生的记录由学号和成绩组成,M名学生的数据已在主函数中放入结构体数组stu中,请编写函数proc(),其功能是:按分数的

学生的记录由学号和成绩组成,M名学生的数据已在主函数中放入结构体数组stu中,请编写函数proc(),其功能是:按分数的高低排列学生的记录,高分在前。注意:部

查看答案

Read the job advertisement below.EXPORT MANAGER WANTEDTRANSW

Read the job advertisement below.EXPORT MANAGER WANTEDTRANSWORLD FREIGHT REQUI

查看答案

Swan thinks all companies should move from old-fashioned ma

Swan thinks all companies should move from old-fashioned marketing to CRM.A.Rig

查看答案

Read the letter from Ms. Yu, a business club secretary.Dear

Read the letter from Ms. Yu, a business club secretary.Dear Mr. Ding,I am t

查看答案