两道改错题9,10,帮做下,谢谢!急!

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:20:32
9。/* 输入三角形的三个边长,若不能组成1个三角形,则输出0;若为等边三角形,则输出1;若为等腰三角形,则输出2;若为一般三角形,则输出3; 其中有2个错误 */
#include <math.h>
int fun(int a,int b,int c)
{
if(a+b>c && b+c>a && a+c>b)
{
if(a==b && b==c)
/**************found**************/
return 1;
else if(a==b&&b==c&&a==c)
return 2;
/**************found**************/
else return 3
}
else return 0;
}
main()
{
int a,b,c,shape;
printf("\nInput a,b,c: "); scanf("%d%d%d",&a,&b,&c);
printf("\na=%d, b=%d, c=%d\n",a,b,c);
shape =fun(a,b,c);
printf("\n\nThe shape : %d\n",shape);
}
10。/* 通过调用函数交换a,b两个数,其中有2个错误 */
#include <conio.h>
#include <stdio.h>
int fun(int *x,int y)
{
int t ;
/**************found**************/
t = x ; x = y ;
/**************found**************/
return(y) ;
}
main()

汗, n年前考的2级,应该是这么改吧:
9.
/**************found**************/
return 1;
else if(a==b||b==c||a==c)
return 2;
/**************found**************/

10.
/**************found**************/
t = *x; y = t;
/**************found**************/

飘来一看,嘎?
啥也看不明白啦!
飘过......

大学编程 我也不会 看都看不懂 我学的是VB 谁知道这位仁兄学的什么啊

貌似是C语言...完全忘记中...领取2分后羞愧的离开...

太专业了..

没看错的话应该是java吧。。。
不会的呢。。。