键盘上的五个值,并打印出这些值及其与平均值(平均值)的差 [英] five values from the keyboard and prints out the values and their difference from the mean (average) value

查看:78
本文介绍了键盘上的五个值,并打印出这些值及其与平均值(平均值)的差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序从键盘接受五个值的输入,并打印出这些值及其与平均值(平均)值的差,我遇到了无法运行该程序的问题.我可以知道我的问题在哪里吗?

my program which accepts input of five values from the keyboard and prints out the values and their difference from the mean (average) value and i encounter a problem that cant run the program. May i know where my problem?

#include <stdio.h>
#include <conio.h>
#define arr_size 5
void main(void)
{
float Value[arr_size], Mean, Sum;
int Count;
clrscr();
printf("Enter 5 values separated by space. \n");
for (Count = 0; Count < arr_size; ++Count)
scanf("%f", &Value[Count]);
Sum = 0;
Mean = 0;
for (Count = 0; Count < arr_size; ++Count)
Sum = Sum + Value[Count];
Mean = Sum/arrisize;
printf("Number \t Value \t Difference \n");
for (Count = 0; Count < arr_size; ++Count)
printf("%i\t %.2f\t %.2f \n", Count + l, Value[Count],Value(Count] — Mean);
}

推荐答案

您认真吗?它甚至不编译,没有声明arrisize.
删除clrscr,修复最后一行中的某些打印错误,必须为:
Are you serious? It does not even compile, arrisize is not declared.
Remove clrscr, fix some misprints in last line, must be:
printf("%i\t %.2f\t %.2f \n", Count + 1, Value[Count],  Value[Count] - Mean);



在尝试编译代码之前,请不要报告问题.
我不想进一步检查-问题非常简单,还不完全达到CodeProject级别.

—SA



Please don''t report problem before trying to compile code.
I don''t want to check it up any further — the problem is ridiculously simple, not quite up to CodeProject level.

—SA


这篇关于键盘上的五个值,并打印出这些值及其与平均值(平均值)的差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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