书上的代码看不懂#includemain(){ char ch;int a,b;do{printf("\n exercise for primary student");printf("\n 1.add");printf("\n 2.subtraction");printf("\n 3.multiplicative");printf("\n 4.divide");printf("\n 5.exit");printf("\n please choice(1~5)an

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 07:56:56
书上的代码看不懂#includemain(){ char ch;int a,b;do{printf(
xn@_e jq4Oe+叶( *4&FTF(b▾5kAPpvv~^y{^CzΓ넢2$4-TҠ2"nNݡo`b {x=R=oK xޘDr SUJ$T\Q0!M<p/_k#V 53Wp7Ënf]V+Zfy8 `e=oًnxwAS s6yg0{Hu_ʑ?zʆG\iq]U.Ϛ~c}~zΘ v0`Rt>Nx(9s; /᛽˳|!-D}

书上的代码看不懂#includemain(){ char ch;int a,b;do{printf("\n exercise for primary student");printf("\n 1.add");printf("\n 2.subtraction");printf("\n 3.multiplicative");printf("\n 4.divide");printf("\n 5.exit");printf("\n please choice(1~5)an
书上的代码看不懂
#includemain(){ char ch;int a,b;do{printf("\n exercise for primary student");printf("\n 1.add");printf("\n 2.subtraction");printf("\n 3.multiplicative");printf("\n 4.divide");printf("\n 5.exit");printf("\n please choice(1~5)and input numbers");scanf("%d%d",&a,&b);ch=getchar();getchar();switch(ch){case '1':printf("\n add sum is %d",a+b); break;case '2':printf("\n subtraction",a-b); break;case '3':printf("\n multiplicative",a*b); break;case '4':printf("\n divide",a/b); break;case '5':printf("\n end."); break;default:printf("\n error.choice again."); break;}}while(ch!='5');}
其中
scanf("%d%d",&a,&b);ch=getchar();getchar();
还有程序好像不成功

书上的代码看不懂#includemain(){ char ch;int a,b;do{printf("\n exercise for primary student");printf("\n 1.add");printf("\n 2.subtraction");printf("\n 3.multiplicative");printf("\n 4.divide");printf("\n 5.exit");printf("\n please choice(1~5)an
scanf("%d%d",&a,&b);
的意思是从键盘读入两个整数,第一个给a,第二个给b
ch=getchar();
的意思是从键盘读入一个字符给ch
getchar();
的意思是从键盘读入任意一个字符(可以理解为等待用户在键盘敲一个键,然后从能继续运行)