- 论坛徽章:
- 0
|
- #include <stdio.h>
- #include <math.h>
- void main()
- {
- printf("Please input a,b,c!\n");
- double a,b,c,answer,answer1,answer2,f,r;
- scanf("%lf %lf %lf",&a,&b,&c);
- f=b*b-4*a*c;
- if (f<0.0)
- {
- printf("There are no answers!\n");
- }
- else if(f==0.0)
- {
- answer=(-b/(2.0*a));
- printf("The answer is %lf!\n",answer);
- }
- else
- {
- r=sqrt(f);
- answer1=((-b+r)/(2*a));
- answer2=((-b-r)/(2*a));
- printf("The answers are %lf and %lf!\n",answer1,answer2);
- }
- }
复制代码 这是求二次方程根的小程序
编译通过 运行时报错:
Linking...
求根.obj : error LNK2005: _main already defined in za1.obj
Debug/za总.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.
za总.exe - 1 error(s), 0 warning(s)
求解 |
|