public class Demo05 {
public static void main(String[] args) {
while (true) {
System.out.println("1、加法运算");
System.out.println("2、减法运算");
System.out.println("3、乘法运算");
System.out.println("4、除法运算");
System.out.println("请选择运算功能的序号:");
Scanner scanner = new Scanner(System.in);//创建一个扫描器对象,从键盘接受数据
int x = scanner.nextInt();//输入一个数
switch (x) {
case 1:
System.out.println("您选择的是加法运算:");<
使用java简单基础写一个计算器,要求实现加减乘除功能,并且能够循环接收新的数据,通过用户交互实现
最新推荐文章于 2024-03-30 20:37:43 发布