出售本站【域名】【外链】

C语言编程设计,分段计算乘坐地铁票价,速度速度~



#include <stdio.h>

int main(ZZZoid){
int V=0;
int y=0;
printf("Please input km=");
scanf("%d",&V);

if(V>26){
y=6;
}
else if(V>16){
y=5;
}
else if(V>6){
y=4;
}
else/* if(V>1)*/{
y=3;
}
printf("%d公里:地铁票价%d 元\n",V,y);
}

诘问

Cpp1.eVe - 20 error(s), 0 warning(s)

逃答

#include
int main(ZZZoid){

int V=0;
int y=0;
printf("Please input km=");
scanf("%d",&V);

if(V>26){
y=6;
}
else if(V>16){
y=5;
}
else if(V>6){
y=4;
}
else/* if(V>1)*/{
y=3;
}
printf("%d公里: 地铁票价%d 元\n",V,y);

}



2025-02-27 15:06  阅读:120