kbys.net
当前位置:首页 >> C语言 要求编写一个简单计算器的程序 >>

C语言 要求编写一个简单计算器的程序

#includevoid main() { float x,y,z; char c; scanf("%f%c%f",&x,&c,&y); switch ( c ) { case '+': z=x+y; break; case '-': z=x-y; break; case '*': z=x*y; break; case '/': z=( y==0 )?(0):(x/y); break; default: z=0; break; } printf("%...

#include"stdio.h" void main() { float a,b,c; char e; printf("input a,e,b\n");/*输入两个数和符号,例如3+8*/ scanf("%f%c%f",&a,&e,&b); switch(e) { case '+':c=a+b;break; case '-':c=a-b;break; case '*':c=a*b;break; case '/': if(b==...

这是基本的框架,C语言对图形界面支持不好,请问你还要继续让我写下去吗#include "stdafx.h"#include "stdio.h"int main(){ int add(); int sub(); int mul(); int div(); int choose; printf(" 加 减 乘 除 关闭计算器\n"); printf("请输入您要...

如果我的回答你还满意记得选个满意答案哦#include void main() { float a,b; char c; printf("请输入两个操作数:"); scanf("%f",&a); scanf("%f",&b); getchar(); printf("请选择操作运算:"); scanf("%c",&c); switch(c) { case '+': printf("结...

怎么每个计算器的要求都不一样

#include int main() { char c = 'Y'; float x,y,z; char operate; while(c=='Y' || c=='y') { printf("please enter number1:"); scanf("%f",&x); printf("please enter operate:"); getchar(); scanf("%c",&operate); printf("please enter nu...

#include int main(){ char judge,oper; double a, b,result; printf("是否需要计算,输入Y或y表示需要,输入N或n表示不需要\n"); judge = getchar(); while (judge != 'N' && judge != 'n') { if (judge == 'Y' || judge == 'y') { printf("请...

#include "stdio.h" void main() { float a,b,c; char ch,ch1; printf("请输入表达式如 5+6= 然后按回车键:"); scanf("%f%c%f%c",&a,&ch,&b,&ch1); switch(ch) { case '+': c=a+b; printf("%f+%f=%f\n",a,b,c); break; case '-': c=a-b; printf(...

#include void main() { float a,b; char d; printf("请输入两个数a,b:"); scanf("%f,%f"&a,&b); printf("请输入符号d"); scanf("%c",d); switch(d) { case'+':printf("%f\n,a+b);break; case'-':printf("%f\n,a-b);break; case'*':printf("%...

网站首页 | 网站地图
All rights reserved Powered by www.kbys.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com