本文介绍了代码中未指定的错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道怎么了,有人可以帮助我吗? ;/应该这样做:
必须重复执行该程序,直到(人工)引入的符号结尾.

每一代都必须引入更多的变量值.
根据结果​​进行计算(计算第一个实验
条件)(一定数量的步骤)应首先附加,然后
推导结果(z)的第一步.在每个步骤之后,必须显示
评论并获得一个新的号码.例如:S = 6且z = 1、3、4、7.在序列Z = 1、3、4、7中加减四次(S = 6).

I don''t know what is wrong, can anyone help me? ;/ It should do this:
The program must be repeated until the end of the symbol introduced in (an artificial person).

Every generation must be introduced further variables values.
Basis, the calculation to the result (counting the first lab
condition) (step a certain number (s)) shall be initially attached, and then the
the initial step in the deduction of the result (z). After each step, must be shown
Comments and obtained a new number. Eg.: S = 6 and z = 1, 3, 4, 7. Adding and subtract four times (S = 6) a step in the sequence Z = 1, 3, 4, 7.

#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
    char ch='#';
    do
    {
        if (ch!='#')
        {
            printf("\n");
        }
        int R, H;
    float S;
    printf("Input R \n");
    scanf("%d", &R);
    printf("Input H \n");
    scanf("%d", &H);
    S=2 * PI * R * (R + H);
    printf("S = %4.5f\n", S);
        if (  S!=0 )
        {
            result= 1/S;
            printf ( "R= %.0f , H= %.0f answer is %.2lf.\n\n",sk1 ,sk2 , result  );
            printf (" 4 Steps Adding and subtracting:\n\n");
            rez = result;
            int s[4];                                                           //4 cycle values
            s[0] = 1;
            s[1] = 3;
            s[2] = 4;
            s[3] = 7;
            for ( i = 0; i < 4; i++)                                            // first of all i = 0, carried out four times and added to a
            {
                printf("%d step. plus %d, answer  %.2lf\n", i+1, s[i], rez+=s[i]);
            }
            printf("\n");
            for ( i = 0; i < 4; i++)                                            //only deprived of the same
            {
                printf("%d step. minus %d, answer  %.2lf\n", i+1, s[i], result-=s[i]);
            }
            printf("\n");
        }
        else
        {
            printf("\nSolution is impossible, because division by zero is not\n\n");
        }
        getchar();
        printf("\nEnter the characters repeat the program betkoki (enter only one symbol)\n");
        printf("To stop it please enter #\n");
        }
    while ((ch = getchar()) != '#');
    printf("\nProgram done!\n");
    system("PAUSE");
    return 0;
}

推荐答案

result= 1/S;
printf ( "R= %.0f , H= %.0f answer is %.2lf.\n\n",sk1 ,sk2 , result  );


resultsk1sk2的声明在哪里?
尝试对变量使用明智的名称,而不要使用单个字符,也许错误会更容易发现.


Where are the declarations of result, sk1 and sk2?
Try using sensible names for your variables instead of single characters and perhaps the errors will be easier to spot.


这篇关于代码中未指定的错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:31