关于C程序调试问题
发布网友
发布时间:2022-05-04 20:13
我来回答
共3个回答
热心网友
时间:2022-06-25 14:05
错误太多,编译就不过,帮你改了,你看看
-------------------------------------------------
#include <stdio.h>
#include <math.h>
main(){
int count = 0;
int peifang[17],i,j;
char password[16];/*口令*/
char t,l='%';
float k,h,sum[9];
char liaoming[17][16]={ /*字符串数组*/
"嵩*石","石英","仁村料","博爱料","泌阳料",
"济源料","膨润土","山东滑石","赤江泥","三厂瓷粉(内加)",
"大同土","熟大同","汝州毛土","禹县毛土","山*土",
"广西料","透辉石"
};/* 字符串用"" */
float shujv[17][9]={{67.86,18.05,0.27,0.02,0.21,0.09,10.27,3.02,0.75},{94.6,2.67,0.12,0.18,0,0.47,0.29,0,0.36},{78.61,11.53,0.14,0.06,0.52,0.07,9.72,0.18,0.55},{46.11,36.97,0.56,1.56,0.29,0.49,1.42,0.3,12.89},{47.25,37.08,0.59,0.76,0,0.38,2.24,0.52,10.82},{31.47,48.65,0.29,1.12,0.36,0.87,1.97,0.15,12.35},{70.51,15.18,0.84,0.08,1.65,3.37,0.34,0.28,7.39},{61.46,0.37,0.09,0,1.12,30.24,0.09,0.24,6.85},{61.69,24.55,1.35,0.69,0.01,0.31,1.52,0.28,8.8},{67.64,24.19,0.42,0.36,0.84,1.14,2.55,0.89,0.29},{45.38,36.04,0.31,0.4,0.42,0.08,0.28,0,17.44},{53.68,44.3,0.15,0.39,0.17,0.03,0.08,0.11,0.58},{54.19,30.33,0.45,0,0.08,0.07,0.64,0,12.5},{62.8,11.49,1.44,0.41,1.82,0.13,0.48,0,19.27},{44.33,36.19,0.85,1.58,0.97,0.06,0.09,0.06,15.43},{74.67,16.52,0.18,0.02,0.01,0.16,3.09,0.12,5.12},{55.03,1.10,0.30,0.30,0.49,0.18,0,0.40,15.22}};
char yuansu[9][4]={"Si","Al","Fe","Ti","Ca","Mg","K","Na","IL"};
/*各个数组赋值完毕*/
printf("\n欢迎使用陶瓷胎料配方成分计算器,红星陶瓷开发部制作.版本0.01");
getch();/*while(getchar())\f */
printf("\n联系方式:Email:mfkickdx78@163.com\t红星陶瓷开发部制作.版本0.01");
getch();/*while(getchar()) */
printf("\n请输入口令:");
while(1)
{
/*while(getchar()!='lyhxtc.kfb\n') */
gets(password);
if(strcmp(password, "123456") == 0) break;
printf("\n第%d次输入!\n口令错误,请重新输入:",++count);
/*至此口令部分结束*/
}
/*{ */
for(i=0;i<=16;i++)
{ /*应该在这里吧*/
/*printf("配方中%c的量为",liaoming[i]); */
printf("配方中%s的量为(整数):",liaoming[i]);
scanf("%d",&peifang[i]);
/*至此利用for循环完成配方输入*/
}
{
for(j=0;j<=8;j++)
for(i=0;i<=16;i++)
/* sum[j]=sum[j]+shujv[i][j]*n[i];// sum , n 都没有定义 */
sum[j]=sum[j]+shujv[i][j]*peifang[i];
/*至此利用for双重循环完成对配方各项含量计算*/
}
{
for(i=0;i<=8;i++)
k=sum[i]+sum[i+1];
/*计算出总和1*/
}
{
for(i=0;i<=7;i++)
h=sum[i]+sum[i+1];
/*计算出总和2*/
}
printf("泥料各项控制数据含量为:\n");
{
for(i=0;i<=8;i++)
printf("%s:%f%%\n",yuansu[i],sum[i]/k);
}
printf("成瓷各项控制数据含量为:\n");
{
for(i=0;i<=7;i++)
printf("%s:%f%%\n",yuansu[i],sum[i]/h);
/*输出计算所得结果*/
}
return 0;
}
热心网友
时间:2022-06-25 14:05
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
热心网友
时间:2022-06-25 14:06
zhengjie!