小编abu*_*hay的帖子

代码未在终端中运行

我刚开始学习C,在此之前我不懂编程.

所以我试图运行这个统计程序,它将读取输入并给出你的意思,方差等.我用终端来运行程序.我几乎复制了我正在使用的书中的代码.

我运行代码时没有错误,但是当我输入输入时,它没有做任何事情.代码如下.

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

int main()
{
    float x, max, min, sum, mean, sum_of_squares, variance;
    int count;
    printf("Enter data: "); /* not included in the original code*/

    if( scanf("%f", &x) == EOF )
        printf("0 data items read.\n");
    else{
        max = min = sum = x;
        count = 1;
        sum_of_squares = x * x;
        while(scanf("%f", &x) != EOF) {
            count += 1;
            if (x > max)
                max = x;
            if ( x < min)
                min = x;
            sum …
Run Code Online (Sandbox Code Playgroud)

c terminal

4
推荐指数
1
解决办法
100
查看次数

标签 统计

c ×1

terminal ×1