怎样在vs2013中运行编好的c程序 求指导
#include"stdafx.h"#include<stdio.h>#include<math.h>doublet[11]={1.84,1.32,1.20,1.14,1...
#include "stdafx.h"
#include<stdio.h>
#include<math.h>
double t[11] = { 1.84, 1.32, 1.20, 1.14, 1.11, 1.09, 1.08, 1.07, 1.06, 1.05, 1.03 };
double x(int n, double b, double *a)
{
int i;
double sum = 0, aver, al, result;
for (i = 0; i<n; i++)
sum = sum + *(a + i);
aver = sum / n;
for (i = 0, sum = 0; i<n; i++)
sum = sum + pow(fabs(*(a + i) - aver), 2);
al = pow(sum / (n*n - 1), 0.5);
printf("平均值实验标准差%lf\n", al);
al = t[n - 2] * al;
printf("平均值实验标准差最佳估计值%lf\n", al);
result = pow(pow(al, 2) + pow(b / pow(3, 0.5), 2), 0.5);
return result;
}
int main()
{
double a[1000], b, e;
int n, i;
char f = 'y';
while (f == 'y' || f == 'Y')
{
printf("输入实验次数\n");
scanf_s("%d", &n, 1);
printf("输入实验数据\n");
for (i = 0; i<n; i++)
{
scanf_s("%lf", &e, 1);
a[i] = e;
}
printf("输入仪器不确定度\n");
scanf_s("%lf", &b, 1);
printf("不确定度为%lf\n", x(n, b, a));
printf("继续输入y 否任意键\n");
getchar();
f = getchar();
}
return 0;
}
生成解决方案
运行
为什么没有相应的运行窗口 就像vc6.0那样 展开
#include<stdio.h>
#include<math.h>
double t[11] = { 1.84, 1.32, 1.20, 1.14, 1.11, 1.09, 1.08, 1.07, 1.06, 1.05, 1.03 };
double x(int n, double b, double *a)
{
int i;
double sum = 0, aver, al, result;
for (i = 0; i<n; i++)
sum = sum + *(a + i);
aver = sum / n;
for (i = 0, sum = 0; i<n; i++)
sum = sum + pow(fabs(*(a + i) - aver), 2);
al = pow(sum / (n*n - 1), 0.5);
printf("平均值实验标准差%lf\n", al);
al = t[n - 2] * al;
printf("平均值实验标准差最佳估计值%lf\n", al);
result = pow(pow(al, 2) + pow(b / pow(3, 0.5), 2), 0.5);
return result;
}
int main()
{
double a[1000], b, e;
int n, i;
char f = 'y';
while (f == 'y' || f == 'Y')
{
printf("输入实验次数\n");
scanf_s("%d", &n, 1);
printf("输入实验数据\n");
for (i = 0; i<n; i++)
{
scanf_s("%lf", &e, 1);
a[i] = e;
}
printf("输入仪器不确定度\n");
scanf_s("%lf", &b, 1);
printf("不确定度为%lf\n", x(n, b, a));
printf("继续输入y 否任意键\n");
getchar();
f = getchar();
}
return 0;
}
生成解决方案
运行
为什么没有相应的运行窗口 就像vc6.0那样 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询