请检查这个编码中的问题是什么,并为我纠正 [英] please check whats the problem in this coding and correct it for me

查看:74
本文介绍了请检查这个编码中的问题是什么,并为我纠正的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  #include   <   stdio.h  >  
#include < conio.h >
#include < math.h >

int main()
{
float a,b,c,alf,bt,dlt;
clrscr();

printf( \ n输入:);
scanf( %f,& a);

printf( \ n输入b:);
scanf( %f,& b);

printf( \ n输入c:);
scanf( %f,& c);

dlt = b * b- 4 * a * c;

if (dlt == 0
{
printf( \ n ALPHA = BETA =%f, - b /( 2 * A));
}
elseif(dlt< 0)
{
printf( \\\
虚构的根
);
}
else
{
alf =( - b + sqrt(dlt))/( 2 * A);
bt =( - b-sqrt(dlt))/( 2 * a);
printf( \ n \ n Alpha =%f \ n Beta =%f \ N,ALF,BT);
}

getch();

return 0 ;
}





[edit]已添加代码块 - OriginalGriff [/ edit]

解决方案
否。有几个原因。


1)我们不知道它有什么问题。可能是编译错误,可能是运行时错误。

2)我们不知道预期会做什么,它没有,或者不期望这样做。

3)我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但是我们不打算为你做这一切!



如果你尝试编译时出现问题,请查看错误信息 - 如果可以的话弄清楚告诉我们消息是什么以及它报告的是什么行。

如果在尝试运行应用程序时出现问题,请尝试使用调试器逐步查看代码并查看究竟发生了什么。

如果这是一个你不知道如何编码以适应你的任务的问题,那么解释一下,你的任务是什么,以及你尝试过什么。

#include<stdio.h>
#include<conio.h>
#include<math.h>

int main()
{
    float a,b,c,alf,bt,dlt;
    clrscr();

    printf("\n Enter a: ");
    scanf("%f",&a);

    printf("\n Enter b: ");
    scanf("%f",&b);

    printf("\n Enter c: ");
    scanf("%f",&c);

    dlt=b*b-4*a*c;

    if(dlt==0)
    {
        printf("\n ALPHA=BETA=%f",-b/(2*a));
    }
    elseif(dlt<0)
    {
        printf("\n Imaginary Roots");
    }
    else
    {
        alf=(-b+sqrt(dlt))/(2*a);
        bt=(-b-sqrt(dlt))/(2*a);
        printf("\n\n Alpha = %f\n Beta=%f\n",alf,bt);
    }

    getch();

    return 0;
}



[edit]Code block added - OriginalGriff[/edit]

解决方案

No. For a couple of reasons.

1) We don't know what is wrong with it. Could be compilation error, could be run time error.
2) We don't know what it is expected to do that it doesn't, or not expected to do that it does.
3) We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

If it's a problem when you try to compile, look at the error message - and if you can't figure it out tell us what the message is and what line it is reporting on.
If it's a problem when you try to run the app, then try using the debugger to step though your code and see exactly what is going on.
If it's a problem where you don't know how to code to fit your task, then explain that, what your task is, and what you have tried.


这篇关于请检查这个编码中的问题是什么,并为我纠正的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆