nynw.net
当前位置:首页 >> 输入两个数,然后输入一个运算符,计算出结果输出... >>

输入两个数,然后输入一个运算符,计算出结果输出...

import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("输入第一个数"); double x=input.nextDouble(); System.out.println("输入第二个数"); d...

如果我的回答你还满意记得选个满意答案哦#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 "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 int main() { int num1,num2,num3=0; char a; while(1) { printf("input:"); scanf("%d%c%d",&num1,&a,&num2); /* switch(a) { case '+':num3 = num1+num2;break; case '-':num3 = num1-num2;break; case '*':num3 = num1*num2;break; ...

我会做

static void Main(string[] args) { string str = "",math=""; while (true) { bool IsOk = true; Console.WriteLine("请输入两个正整数(以空格分开)"); str = Console.ReadLine(); if (str == "#") break; Console.WriteLine("请输入一个运算...

#includeint main(){double a,b,c; char op; scanf("%lf%c%lf",&a,&op,&b); if(op=='+')c=a+b; else if (op=='-')c=a-b; else if (op=='*')c=a*b; else if (op=='/') if(b)c=a/b; else {printf("除数不能为0!\n"); return 0;} printf("%g%c%g=%g...

#includeint main(){int x,y,z; char op; scanf("%d%c%d",&x,&op,&y); switch(op) {case '+':z=x+y;break; case '-':z=x-y;break; case '*':z=x*y;break; case '/':if(y)z=x/y; else {printf("Error!"); return 0;} break; case '%':if(y){z=x%y...

#includeint main(){ int a, b; char op; scanf ("%d%d %c", &a, &b, &op); if (op == '+'){printf ("%d\n", a+b);} else if (op == '-'){printf ("%d\n", a-b);} else if (op == '*'){printf ("%d\n", a*b);} else if (op == '/'){printf ("%d\...

精确到两位小数: #include void main() { int a,b; double result; char c; scanf("%d%d",&a,&b); getchar(); c=getchar(); switch(c) { case '+':result=a+b;break; case '-':result=a-b;break; case '*':result=a*b;break; case '/':result=a...

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