这段 C 语言代码存在一些问题: 1. 在 `if(x = 50)` 这里,应该使用 `if(x == 50)` ,`=` 是赋值运算符,`==` 才是比较运算符,用于判断是否相等。 以下是修改后的代码: ```c #include<stdio.h> int main() { int x; float cost; scanf("%d",&x); if(x<0) { printf("invalid value!"); } if(x<50) { cost=0.53*x; printf("cost = %.2f",cost); } if(x == 50) // 修改此处 { printf("cost = 26.50"); } if(x>50) { cost=(x-50)*0.58+26.50; printf("cost = %.2f",cost); } return 0; } ``` [2024-11-05 09:31:52 | AI写代码神器 | 242点数解答]