新手编程问题求解
程序代码:
void showatoc() { char *str[4]={"You can Select:","A:60/300 !","B: 80/500 !","C:160/900!"}; int i; for(i=0;i<4;i++) printf("%s\n",str[i]); } void comput(int x1,int x2,int x3,float x4) { if((x1<0)||(x1>24*60*31)) printf("输入数据不合法!\n"); else {if(x1>x2) printf("本月应支付的费用为:%f\n",x3+(x1-x2)*x4); else printf("本月应支付的费用为:%d\n",x3); } } void main() { char ch; int x; printf("输入本月通话时间\n"); scanf("%d",&x); system("cls"); showatoc(); for(;;) { ch=getch(); switch(ch) { case 'A': case 'a': comput(x,300,60,0.4); break; case 'B': case 'b': comput(x,500,80,0.35); break; case 'C': case 'c': comput(x,900,160,0.25); break; default: break; } printf("还需要算吗?\n"); ch1=getch(); if(ch1=='Y'||ch1=='y') { printf("输入本月通话时间\n"); scanf("%d",&x); system("cls"); showatoc(); } else break; } system("cls"); printf("\n\t谢谢使用!\n\n"); system("pause"); }红色那一行显示错误,为什么?