| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 406 人关注过本帖
标题:错在哪里呢?
取消只看楼主 加入收藏
雪燃
Rank: 2
等 级:论坛游民
帖 子:17
专家分:43
注 册:2010-2-9
结帖率:83.33%
收藏
已结贴  问题点数:5 回复次数:1 
错在哪里呢?
#include<stdio.h>
#include<math.h>

int main(void)
{
   int a = 1;
   int b = 2;
   int c = 3;
   float delta;
   float x1;
   float x2;
   delta = b * b - 4 * a * c;

   if (delta > 0)
   {
       x1 = (-b + sqrt(delta)) / (2 * a);
       x2 = (-b - sqrt(delta)) / (2 * a);
       printf("该一元二次方程有两个解,x1 = %f, x2 = %f\n", x1,x2);
   }
   else if (delta = 0)
   {
       x1 = (-b) / (2 * a);
       x2 = x1;
       printf("该一元二次方程有一个唯一解,x1 = x2 = %f",x1);
   }
   else
   {
       printf("该一元二次方程无解");
   }
   return 0;
}


--------------------Configuration: 1 - Win32 Debug--------------------
Compiling...
1.cpp
E:\练习\1\1.cpp(12) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
E:\练习\1\1.cpp(16) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
E:\练习\1\1.cpp(17) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
E:\练习\1\1.cpp(22) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
E:\练习\1\1.cpp(24) : error C2018: unknown character '0xa3'
E:\练习\1\1.cpp(24) : error C2018: unknown character '0xac'
E:\练习\1\1.cpp(24) : error C2146: syntax error : missing ')' before identifier 'x1'
E:\练习\1\1.cpp(24) : error C2059: syntax error : ')'
执行 cl.exe 时出错.

1.obj - 1 error(s), 0 warning(s)


[ 本帖最后由 雪燃 于 2011-3-27 11:49 编辑 ]
搜索更多相关主题的帖子: void 唯一 include 
2011-03-27 11:41
雪燃
Rank: 2
等 级:论坛游民
帖 子:17
专家分:43
注 册:2010-2-9
收藏
得分:0 
谢谢楼上两位朋友
2011-03-27 13:52
快速回复:错在哪里呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011301 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved