CLion IDE,输出不一致
CLion IDE, inconsistent output
我一直在 CLion IDE 上学习和编码 C 语言。我写了一个程序来计算我的课程成绩,但输出结果总是不一致。例如,有时输出会正确执行,有时 CLion 的终端会在屏幕上显示任何内容。但是,当我使用本机终端执行我的程序时,它总是可以正常工作。 CLion 有什么问题?
这是我的代码:
#include <stdio.h>
double essay_calc(double grd1, double grd2, double grd3)
{
double sum1, sum2, sum3, result;
sum1 = (100*(grd1) / 22.0);
sum2 = (100*(grd2) / 22.0);
sum3 = (100*(grd3) / 22.0);
result = ((sum1*1.10) - sum1 + (sum2*1.15) - sum2 + (sum3*1.20) - sum3);
return (result);
}
double presentation(double pre1, double pre2)
{
double sum1, sum2, result;
sum1 = (100*(pre1))/23.0;
sum2 = (100*(pre2))/40.0;
result = ((sum1 + sum2)/2)/5;
return (result);
}
double hw(double grd1)
{
return ((grd1*15)/100.0);
}
int main(void)
{
double ess_grd1, ess_grd2, ess_grd3, pre_grd1, pre_grd2, hw_grd;
double total, essay, present, howork;
printf("Enter 3 essay grades: ");
scanf("%lf %lf %lf", &ess_grd1, &ess_grd2, &ess_grd3);
printf("\nEnter 2 presentation grades: ");
scanf("%lf %lf", &pre_grd1, &pre_grd2);
printf("\nEnter 1 HW grade: ");
scanf("%lf", &hw_grd);
essay = essay_calc(ess_grd1, ess_grd2, ess_grd3);
present = presentation(pre_grd1, pre_grd2);
howork = hw(hw_grd);
total = (essay + present + howork);
printf("\nEssays: %.2f\n", essay);
printf("Presentations: %.2f\n", present);
printf("Homeworks: %.2f\n", howork);
printf("Total: %.2f\n", total);
if(total < 70)
printf("You have to get %.2f points from final exam to pass\n", 70 - total);
else
printf("Your grade is already over C\n");
return 0;
}
当前版本的 CLion 在终端输出方面存在一些问题,CLion 2016.1.2 Release Candidate 应该可以解决这些问题。
我一直在 CLion IDE 上学习和编码 C 语言。我写了一个程序来计算我的课程成绩,但输出结果总是不一致。例如,有时输出会正确执行,有时 CLion 的终端会在屏幕上显示任何内容。但是,当我使用本机终端执行我的程序时,它总是可以正常工作。 CLion 有什么问题?
这是我的代码:
#include <stdio.h>
double essay_calc(double grd1, double grd2, double grd3)
{
double sum1, sum2, sum3, result;
sum1 = (100*(grd1) / 22.0);
sum2 = (100*(grd2) / 22.0);
sum3 = (100*(grd3) / 22.0);
result = ((sum1*1.10) - sum1 + (sum2*1.15) - sum2 + (sum3*1.20) - sum3);
return (result);
}
double presentation(double pre1, double pre2)
{
double sum1, sum2, result;
sum1 = (100*(pre1))/23.0;
sum2 = (100*(pre2))/40.0;
result = ((sum1 + sum2)/2)/5;
return (result);
}
double hw(double grd1)
{
return ((grd1*15)/100.0);
}
int main(void)
{
double ess_grd1, ess_grd2, ess_grd3, pre_grd1, pre_grd2, hw_grd;
double total, essay, present, howork;
printf("Enter 3 essay grades: ");
scanf("%lf %lf %lf", &ess_grd1, &ess_grd2, &ess_grd3);
printf("\nEnter 2 presentation grades: ");
scanf("%lf %lf", &pre_grd1, &pre_grd2);
printf("\nEnter 1 HW grade: ");
scanf("%lf", &hw_grd);
essay = essay_calc(ess_grd1, ess_grd2, ess_grd3);
present = presentation(pre_grd1, pre_grd2);
howork = hw(hw_grd);
total = (essay + present + howork);
printf("\nEssays: %.2f\n", essay);
printf("Presentations: %.2f\n", present);
printf("Homeworks: %.2f\n", howork);
printf("Total: %.2f\n", total);
if(total < 70)
printf("You have to get %.2f points from final exam to pass\n", 70 - total);
else
printf("Your grade is already over C\n");
return 0;
}
当前版本的 CLion 在终端输出方面存在一些问题,CLion 2016.1.2 Release Candidate 应该可以解决这些问题。