C语言编程问题
求大神,这些都是怎么错的!#include<stdio.h>#include<math.h>#defineEPS1e-1main(){floata,b,c;intflag...
求大神,这些都是怎么错的!
#include <stdio.h>
#include <math.h>
#define EPS 1e-1
main()
{
float a,b,c;
int flag=1;
printf("Input a,b,c:");
scanf("%f,%f,%f",&a,&b,&c);
if (a+b>c,a+c>b,c+b>a)
{
if ((fabs(a-b)<=EPS&&fabs(b-c)<=EPS)&&fabs(a-c)<=EPS)
{
printf("等边");
flag=0;
}
else if (fabs(a-b)<=EPS||fabs(b-c)<=EPS)||fabs(a-c)<=EPS)
{
printf("等腰");
flag=0;
}
if (fabs(a*a+b*b-c*c)<=EPS)||fabs(a*a-b*b=c*c)<=EPS)||fabs(-a*a+b*b+c*c)<=EPS)
{
printf("直角");
flag=0;
}
if (flag)
printf("一般");
printf("三角形");
}
else printf("不是");
}
--------------------Configuration: A 1 - Win32 Debug--------------------
Compiling...
a.c
d:\软件\microsoft visual studio\myprojects\A 1\a.c(17) : error C2143: syntax error : missing ';' before '||'
d:\软件\microsoft visual studio\myprojects\A0 1\a.c(22) : error C2143: syntax error : missing ';' before '||'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(27) : error C2059: syntax error : 'if'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2143: syntax error : missing ')' before 'string'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2143: syntax error : missing '{' before 'string'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2059: syntax error : '<Unknown>'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2059: syntax error : ')'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(30) : error C2059: syntax error : '}'
d:\软件\microsoft visual studio\myprojects\A0 1\a.c(32) : error C2059: syntax error : '}'
Error executing cl.exe.
A 1.exe - 9 error(s), 0 warning(s) 展开
#include <stdio.h>
#include <math.h>
#define EPS 1e-1
main()
{
float a,b,c;
int flag=1;
printf("Input a,b,c:");
scanf("%f,%f,%f",&a,&b,&c);
if (a+b>c,a+c>b,c+b>a)
{
if ((fabs(a-b)<=EPS&&fabs(b-c)<=EPS)&&fabs(a-c)<=EPS)
{
printf("等边");
flag=0;
}
else if (fabs(a-b)<=EPS||fabs(b-c)<=EPS)||fabs(a-c)<=EPS)
{
printf("等腰");
flag=0;
}
if (fabs(a*a+b*b-c*c)<=EPS)||fabs(a*a-b*b=c*c)<=EPS)||fabs(-a*a+b*b+c*c)<=EPS)
{
printf("直角");
flag=0;
}
if (flag)
printf("一般");
printf("三角形");
}
else printf("不是");
}
--------------------Configuration: A 1 - Win32 Debug--------------------
Compiling...
a.c
d:\软件\microsoft visual studio\myprojects\A 1\a.c(17) : error C2143: syntax error : missing ';' before '||'
d:\软件\microsoft visual studio\myprojects\A0 1\a.c(22) : error C2143: syntax error : missing ';' before '||'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(27) : error C2059: syntax error : 'if'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2143: syntax error : missing ')' before 'string'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2143: syntax error : missing '{' before 'string'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2059: syntax error : '<Unknown>'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(29) : error C2059: syntax error : ')'
d:\软件\microsoft visual studio\myprojects\A 1\a.c(30) : error C2059: syntax error : '}'
d:\软件\microsoft visual studio\myprojects\A0 1\a.c(32) : error C2059: syntax error : '}'
Error executing cl.exe.
A 1.exe - 9 error(s), 0 warning(s) 展开
2个回答
2017-06-10
展开全部
float a, b, c;
int flag = 1;
printf("Input a,b,c:");
scanf("%f,%f,%f", &a, &b, &c);
if (a + b>c, a + c>b, c + b>a)
{
if ((fabs(a - b) <= EPS&&fabs(b - c) <= EPS) && fabs(a - c) <= EPS)
{
printf("等边");
flag = 0;
}
else if (fabs(a - b) <= EPS || fabs(b - c) <= EPS || fabs(a - c) <= EPS)
{
printf("等腰");
flag = 0;
}
if (fabs(a*a + b*b - c*c) <= EPS || fabs(a*a - b*b + c*c) <= EPS || fabs(-a*a + b*b + c*c) <= EPS)
{
printf("直角");
flag = 0;
}
if (flag)
printf("一般");
printf("三角形");
}
else printf("不是");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询