【发布时间】:2020-11-12 12:14:33
【问题描述】:
我正在使用 C 语言编写程序,该程序根据他们在 MVP 等各种标准中获得的平均分来选择项目团队中的员工,所以我得到的错误出现在 switch 声明中,上面写着 error: switch quantity not an integer,而第二个错误是error: case label does not reduce to a an integral constant
代码如下:
#include <stdio.h>
main() {
printf("Google Team Selection\n\n");
double a, b, c, sum, average;
printf("Enter your Minimum Viable Product(MVP) points here:\n");
scanf("%lf", &a);
printf("Enter your Apprenticer Programmer points here:\n");
scanf("%lf", &b);
printf("Enter your consistency points here:\n");
scanf("%lf", &c);
printf("Enter your qocient points");
sum = a + b + c;
average = sum / 3.0;
printf(" the sum is %lf and the average is %lf", sum, average);
switch (average) {
case ">55":
printf("Congratulations you have been selected\n");
break;
}
}
所以,我希望我的程序选择平均水平高于55 的员工。
【问题讨论】:
-
抱歉,这与 StrongLoop 有什么关系?根据标签描述:“StrongLoop 是一个 API 层,用于将企业数据连接到设备和浏览器。它包括 LoopBackJS、StrongOps 和 StrongNode。”
-
由任何体面的书籍/教程回答,或在 switch 语句中询问范围/更大/更小的各种问题的副本,例如Larger than and less than in C switch statement
标签: c