为一个“计算器”应用程序创建一个GUI。将使用网格布局在一个框架中放置数字和操作按钮。 创建一个名为Cal

作者&投稿:剧辉 (若有异议请与网页底部的电邮联系)
CAD中CAL计算器的用法~

我很少用到的,一般就直接输入公式'cal。注意前面有一符号“'”,例如:求25的平方根:输入‘cal,就会弹出提示,再输入sqrt(25),完成。

是用awt和swing做的,很好看比单单用AWT做好看
import java.awt.*;
import javax.swing.*;
public class Conputer extends JFrame {
protected Container con = getContentPane();// 指向内容面板
protected JMenuBar a = new JMenuBar();// 菜单条
protected JMenu a1 = new JMenu("编辑(E)");// 菜单1
protected JMenu a2 = new JMenu("查看(V)");// 菜单2
protected JMenu a3 = new JMenu("帮助(H)");// 菜单3
protected JMenuItem a11 = new JMenuItem("复制(C)", 'C');// 菜单1的菜单项
protected JMenuItem a12 = new JMenuItem("粘贴(P)", 'P');// 菜单1的菜单项
protected JMenuItem a21 = new JMenuItem("标准型(T)", 'T');// 菜单2的菜单项
protected JMenuItem a22 = new JMenuItem("科学型(S)", 'S');// 菜单2的菜单项
protected JMenuItem a31 = new JMenuItem("帮助主题(H)", 'H');// 菜单3的菜单项

protected JTextField jtf = new JTextField(30);// 文本框
protected JButton[] jb = new JButton[27];
protected String[] arr = { "Backspace", "CE", "C", "MC", "7", "8", "9", "/", "sqrt",
"MR", "4", "5", "6", "*", "%", "MS", "1", "2", "3", "-", "1/x",
"M+", "0", "+/-", ".", "+", "=" };

protected JPanel jp = new JPanel();// 主面板
protected JPanel m = new JPanel();// 次面板
protected JPanel m1 = new JPanel();// 次次面板
protected JPanel m2 = new JPanel();// 次次面板
protected JPanel m3 = new JPanel();// 次次面板
protected JPanel m4 = new JPanel();// 次次面板
protected JPanel m5 = new JPanel();// 次次面板
protected JPanel m6 = new JPanel();// 次次面板

protected GridLayout glo = new GridLayout(6, 1, 3, 3);// 主网格布局
protected GridLayout glo1 = new GridLayout(1, 3, 3, 3);// 次网格布局
protected GridLayout glo2 = new GridLayout(1, 6, 3, 3);// 次网格布局

protected Conputer(String s) {
super(s);
a1.setMnemonic('E');
a1.add(a11);
a1.add(a12);
a2.setMnemonic('V');
a2.add(a21);
a2.add(a22);
a3.setMnemonic('H');
a3.add(a31);
a.add(a1);
a.add(a2);
a.add(a3);
this.setJMenuBar(a);// 菜单条完成

for (int i = 0; i < 27; i++) {
jb[i] = new JButton(arr[i]);
}

jp.setLayout(glo);
jp.add(m1);
m1.add(jtf);
jtf.setEditable(false); jtf.setText("0."); jtf.setForeground(Color.BLUE); jtf.setBackground(Color.WHITE);
jtf.setHorizontalAlignment(JTextField.RIGHT);//文本显示在右边

jp.add(m2);
m2.setLayout(glo1);
m2.add(jb[0]);
m2.add(jb[1]);
m2.add(jb[2]);

jp.add(m3);
m3.setLayout(glo2);
m3.add(jb[3]);
m3.add(jb[4]);
m3.add(jb[5]);
m3.add(jb[6]);
m3.add(jb[7]);
m3.add(jb[8]);

jp.add(m4);
m4.setLayout(glo2);
m4.add(jb[9]);
m4.add(jb[10]);
m4.add(jb[11]);
m4.add(jb[12]);
m4.add(jb[13]);
m4.add(jb[14]);

jp.add(m5);
m5.setLayout(glo2);
m5.add(jb[15]);
m5.add(jb[16]);
m5.add(jb[17]);
m5.add(jb[18]);
m5.add(jb[19]);
m5.add(jb[20]);

jp.add(m6);
m6.setLayout(glo2);
m6.add(jb[21]);
m6.add(jb[22]);
m6.add(jb[23]);
m6.add(jb[24]);
m6.add(jb[25]);
m6.add(jb[26]);

m.add(jp);
con.add(m);

this.setResizable(false);// 不能用鼠标拉伸窗体
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//可以关闭窗体
this.setSize(380, 275);
this.setVisible(true);

}

protected Conputer() {
this("计算器");
}

public static void main(String[] args) {
new Conputer("计算器");
}

}

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

class Stack_Float
{
float nums[];
int top;

Stack_Float()
{
nums = new float[50];
top = -1;
}

boolean IsEmpty()
{
if (top == -1)
return true;
else
return false;
}

float Pop_Stack()
{
if (top == -1)
{
return 0;
}
top--;
return nums[top + 1];
}

float GetTop()
{
return nums[top];
}

void Push_Stack(float num)
{
if (top == 49)
return;
top++;
nums[top] = num;
}
}

class Stack_Char
{
char str[];
int top;

Stack_Char()
{
str = new char[50];
top = -1;
}

boolean CanPush(char c)
{
int temp = top;
if (c == '(')
{
while (temp != -1)
{
if (str[temp] == '(')
{
return false;
}
temp--;
}
}
temp = top;
if (c == '[')
{
while (temp != -1)
{
if (str[temp] == '[' || str[temp] == '(')
{
return false;
}
temp--;
}
}
if (c == '{')
{
while (temp != -1)
{
if (str[temp] == '{' || str[temp] == '[' || str[temp] == '(')
{
return false;
}
temp--;
}
}
return true;
}

boolean IsEmpty()
{
if (top == -1)
return true;
else
return false;
}

void Push_Stack(char ch)
{
if (top == 49)
return;
top++;
str[top] = ch;
}

char Pop_Stack()
{
if (top == -1)
return '\0';
top--;
return str[top + 1];
}

char GetTop()
{
if (top == -1)
{
System.out.print("error");
System.exit(0);
}
return str[top];
}
}

public class jisuanqi extends javax.swing.JFrame implements ActionListener
{
JTextField text = new JTextField();
JTextField text1 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JButton jButton7 = new JButton();
JButton jButton8 = new JButton();
JButton jButton9 = new JButton();
JButton jButton10 = new JButton();
JButton jButton11 = new JButton();
JButton jButton12 = new JButton();
JButton jButton13 = new JButton();
JButton jButton14 = new JButton();
JButton jButton15 = new JButton();
JButton jButton16 = new JButton();
JButton jButton17 = new JButton();
JButton jButton18 = new JButton();
JButton jButton19 = new JButton();
JButton jButton20 = new JButton();
JButton jButton21 = new JButton();
JButton jButton22 = new JButton();
String show = "";

public jisuanqi()
{
initComponents();
}

char[] TranSmit(char str[])
{
char houzhui[] = new char[50]; // 存放后缀表达式的字符串
int i = 0, j = 0;
char c = str[i];
Stack_Char s = new Stack_Char(); // 存放运算符的栈
while (c != '=') // 对算术表达式扫描未结束时
{
if (c >= '0' && c <= '9')
{
while (c >= '0' && c <= '9')// 数字直接入栈
{
houzhui[j] = c;
j++;
i++;
c = str[i];
}
houzhui[j] = '#';// 用#隔开数字
j++;
}
switch (c) // 扫描到运算符时
{
case '+':
case '-':
case '*':
case '/':
case '(':
case '[':
case '{':
if (s.IsEmpty() == true) // 栈空,直接入栈
{
s.Push_Stack(c);
i++;
c = str[i];
break;
}
if (ComPare(s.GetTop(), c) == -1) {
s.Push_Stack(c); // 入栈
i++;
c = str[i];
break;
}
if (ComPare(s.GetTop(), c) == 1) {
houzhui[j] = s.Pop_Stack();// 出栈元素存入后缀表达式
j++;
break;
}

case ')': // 扫描到 )
while (s.GetTop() != '(') // 未扫描到 ( 时,出栈
{
houzhui[j] = s.Pop_Stack();
j++;
}
s.Pop_Stack(); // '(' 出栈
i++;
c = str[i];
break;
case ']': // 扫描到 ]
while (s.GetTop() != '[') // 未扫描到 [ 时,出栈
{
houzhui[j] = s.Pop_Stack();
j++;
}
s.Pop_Stack(); // '[' 出栈
i++;
c = str[i];
break;
case '}': // 扫描到 }
while (s.GetTop() != '{') // 未扫描到 { 时,出栈
{
houzhui[j] = s.Pop_Stack();
j++;
}
s.Pop_Stack(); // '{' 出栈
i++;
c = str[i];
break;
}
}
while (s.IsEmpty() != true)// 把剩余的运算符直接出栈
{
houzhui[j] = s.Pop_Stack();
j++;
}
houzhui[j] = '=';// 后缀表达式后面加 =
j++;
houzhui[j] = '\0';
j++;
return houzhui;
}

float Count(char str[])
{
Stack_Float s = new Stack_Float();// 定义存放数字的栈
char c = str[0];
int i = 0;
float result = 0, temp, left, right;
while (c != '=') // 未扫描到 = 时
{
if (c >= '0' && c <= '9')// 扫描到数字
{
temp = 0;
while (c != '#')// 未读到分隔符时
{
temp = temp * 10 + c - '0';
i++;
c = str[i];
}
s.Push_Stack(temp);// 进栈
}
switch (c)// 扫描到运算符时
{
case '+':
{
result = s.Pop_Stack() + s.Pop_Stack();// 2个数字出栈相加
s.Push_Stack(result);// 最后得数进栈
break;
}
case '-':
{
right = s.Pop_Stack();// 右操作数出栈
left = s.Pop_Stack();// 左操作数出栈
result = left - right;
s.Push_Stack(result);
break;
}
case '*':
{
result = s.Pop_Stack() * s.Pop_Stack();// 2个数字出栈相乘
s.Push_Stack(result);
break;
}
case '/':
{
right = s.Pop_Stack();// 右操作数出栈
left = s.Pop_Stack();// 左操作数出栈
result = left / right;
s.Push_Stack(result);
break;
}
}
i++;
c = str[i];
}
return result;
}

int ComPare(char a, char b) // 判断运算符的优先级函数
{
int s[][] = {// 栈顶元素高于算术表达式中的元素时, 返回 1,否则返回 -1
{ 1, 1, -1, -1, -1, 1, -1, 1, -1, 1 },
{ 1, 1, -1, -1, -1, 1, -1, 1, -1, 1 },
{ 1, 1, 1, 1, -1, 1, -1, 1, -1, 1 },
{ 1, 1, 1, 1, -1, 1, -1, 1, -1, 1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ 1, 1, 1, 1, -1, 1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ 1, 1, 1, 1, -1, -1, -1, -1, -1, 1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ 1, 1, 1, 1, -1, -1, -1, -1, -1, -1 } };

char x1[] = { '+', '-', '*', '/', '(', ')', '[', ']', '{', '}' };// 栈顶元素
char x2[] = { '+', '-', '*', '/', '(', ')', '[', ']', '{', '}' };// 算术表达式中的元素
int k = 0, m, n = 0;
for (m = 0; m < 10; m++) // 查找2个进行比较的运算符在表中的位置,并返回比较结果
{
for (n = 0; n < 10; n++)
{
if (x1[m] == a && x2[n] == b)
{
k = 1;
break; // 找到比较结果后,跳出循环
}
}
if (k == 1)
break;
}
return s[m][n];// 返回比较结果
}

public void actionPerformed(ActionEvent e)
{
if (e.getSource() == jButton1)
{
show += "1";
text.setText(show);
}
if (e.getSource() == jButton2)
{
show += "2";
text.setText(show);
}
if (e.getSource() == jButton3)
{
show += "3";
text.setText(show);
}
if (e.getSource() == jButton4)
{
show += "4";
text.setText(show);
}
if (e.getSource() == jButton5)
{
show += "5";
text.setText(show);
}
if (e.getSource() == jButton6)
{
show += "6";
text.setText(show);
}
if (e.getSource() == jButton7)
{
show += "7";
text.setText(show);
}
if (e.getSource() == jButton8)
{
show += "8";
text.setText(show);
}
if (e.getSource() == jButton9)
{
show += "9";
text.setText(show);
}
if (e.getSource() == jButton10)
{
show += "0";
text.setText(show);
}
if (e.getSource() == jButton11)
{
show += "+";
text.setText(show);
}
if (e.getSource() == jButton12)
{
show += "-";
text.setText(show);
}
if (e.getSource() == jButton13)
{
show += "*";
text.setText(show);
}
if (e.getSource() == jButton14)
{
show += "/";
text.setText(show);
}
if (e.getSource() == jButton15)
{
show += "(";
text.setText(show);
}
if (e.getSource() == jButton16)
{
show += ")";
text.setText(show);
}
if (e.getSource() == jButton17)
{
show += "[";
text.setText(show);
}
if (e.getSource() == jButton18)
{
show += "]";
text.setText(show);
}
if (e.getSource() == jButton19)
{
show += "{";
text.setText(show);
}
if (e.getSource() == jButton20)
{
show += "}";
text.setText(show);
}
if (e.getSource() == jButton21)
{
show = "";
text.setText("");
text1.setText("");
}
if (e.getSource() == jButton22)
{
show += "=";
text.setText(show);

char str1[] = new char[50];
char str2[] = new char[50];
float result = 0;

str1 = show.toCharArray();
str2 = TranSmit(str1);
result = Count(str2);

text1.setText((new String(str2)).trim());
text.setText("" + result);
show = "";
}
}

private void initComponents()
{
text.setBounds(10, 10, 270, 30);
text1.setBounds(10, 50, 270, 30);
jButton1.setBounds(10, 90, 60, 25);
jButton2.setBounds(80, 90, 60, 25);
jButton3.setBounds(150, 90, 60, 25);
jButton4.setBounds(220, 90, 60, 25);
jButton5.setBounds(10, 120, 60, 25);
jButton6.setBounds(80, 120, 60, 25);
jButton7.setBounds(150, 120, 60, 25);
jButton8.setBounds(220, 120, 60, 25);
jButton9.setBounds(10, 150, 60, 25);
jButton10.setBounds(80, 150, 60, 25);
jButton11.setBounds(150, 150, 60, 25);
jButton12.setBounds(220, 150, 60, 25);
jButton13.setBounds(10, 180, 60, 25);
jButton14.setBounds(80, 180, 60, 25);
jButton15.setBounds(150, 180, 60, 25);
jButton16.setBounds(220, 180, 60, 25);
jButton17.setBounds(150, 210, 60, 25);
jButton18.setBounds(220, 210, 60, 25);
jButton19.setBounds(10, 210, 60, 25);
jButton20.setBounds(80, 210, 60, 25);
jButton21.setBounds(10, 240, 60, 25);
jButton22.setBounds(80, 240, 60, 25);

jButton1.setText("1");
jButton2.setText("2");
jButton3.setText("3");
jButton4.setText("4");
jButton5.setText("5");
jButton6.setText("6");
jButton7.setText("7");
jButton8.setText("8");
jButton9.setText("9");
jButton10.setText("0");
jButton11.setText("+");
jButton12.setText("-");
jButton13.setText("*");
jButton14.setText("/");
jButton15.setText("(");
jButton16.setText(")");
jButton17.setText("[");
jButton18.setText("]");
jButton19.setText("{");
jButton20.setText("}");
jButton21.setText("CE");
jButton22.setText("=");

jButton1.addActionListener(this);
jButton2.addActionListener(this);
jButton3.addActionListener(this);
jButton4.addActionListener(this);
jButton5.addActionListener(this);
jButton6.addActionListener(this);
jButton7.addActionListener(this);
jButton8.addActionListener(this);
jButton9.addActionListener(this);
jButton10.addActionListener(this);
jButton11.addActionListener(this);
jButton12.addActionListener(this);
jButton13.addActionListener(this);
jButton14.addActionListener(this);
jButton15.addActionListener(this);
jButton16.addActionListener(this);
jButton17.addActionListener(this);
jButton18.addActionListener(this);
jButton19.addActionListener(this);
jButton20.addActionListener(this);
jButton21.addActionListener(this);
jButton22.addActionListener(this);

add(text);
add(text1);
add(jButton1);
add(jButton2);
add(jButton3);
add(jButton4);
add(jButton5);
add(jButton6);
add(jButton7);
add(jButton8);
add(jButton9);
add(jButton10);
add(jButton11);
add(jButton12);
add(jButton13);
add(jButton14);
add(jButton15);
add(jButton16);
add(jButton17);
add(jButton18);
add(jButton19);
add(jButton20);
add(jButton21);
add(jButton22);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setBounds(300, 300, 300, 300);
setVisible(true);
}

public static void main(String args[])
{
new jisuanqi();
}
}


手机怎么把计算器游戏藏进里面去呢讲解教程
第三步:设置图标 许多手机都支持更改应用图标的功能。我们可以下载一个类似于计算器图标的图片,然后将其设置为该应用的图标。具体操作方法可以在手机的“设置”-“桌面”-“图标设置”中找到。第四步:隐藏图标 有些手机可以隐藏某些图标,我们可以将计算器应用的图标隐藏起来。方法也很简单,进入手机的...

三星手机如何打开计算器呢?
三星手机的计算器应用通常位于应用抽屉(App Drawer)中。1. 打开应用抽屉 三星手机的应用抽屉是存储所有应用的地方。为了找到计算器,首先需要打开应用抽屉。这通常可以通过点击主屏幕上的应用抽屉图标来完成,该图标通常显示为一组小的应用图标或一个网格图标。2. 搜索计算器 在应用抽屉中,可以使用搜索...

手机自带的计算器删除了怎么恢复
如果手机自带的计算器应用被删除了,你可以尝试通过手机的应用商店重新下载并安装,或者在手机设置中进行应用恢复。具体方法取决于你使用的手机型号和系统。详细 对于大多数智能手机用户来说,恢复误删应用的方法主要有两种。第一种是通过手机的应用商店。每款手机都配备有相应的应用商店,用户可以在其中搜索并...

手机计算器删除了怎么恢复
要恢复手机计算器,可以通过以下几种方法:在应用商店重新下载安装、查看手机设置中的应用管理或应用程序、检查应用抽屉或文件夹、使用手机备份恢复等。1. 在应用商店重新下载安装 如果计算器应用被误删或丢失,可以尝试在应用商店搜索并重新下载安装。打开应用商店应用,搜索“计算器”,然后选择与手机品牌或...

手机计算器怎么连加
该应用连加方法步骤如下:1、打开计算器应用:在手机的主屏幕上找到计算器应用的图标,点击它打开计算器。2、输入第一个数字:点击数字键输入添加加号:输入第一个数字后,点击加号(+)键,以便为下一个数字创建一个加法表达式。第一个加数。3、添加加号:输入第一个数字后,点击加号(+)键,以便为...

计算器在哪个文件夹里?
C:\\Program Files\\WindowsApps 但是,由于权限设置,即使你尝试访问这个文件夹,也可能会遇到拒绝访问的情况。WindowsApps文件夹包含了所有从Microsoft Store安装的UWP应用,它们被安装在一个隔离的环境中,这样可以提供安全性并允许每个应用程序独立更新和管理。如果你想要直接访问计算器应用,你可以尝试以下方法...

伪装成计算器隐藏应用软件真的有用吗?
后期,如果大家想恢复APP,只要进入设置,勾选“显示启动应用提示框”。点击被隐藏的应用,选择“取消隐藏”,软件就会重新安装到桌面。值得一提的是,如果你不卸载桌面原图标,就能间接实现应用双开。为了防止被别人发现,应用隐藏大师还支持将自己伪装成计算器。从表面看起来,它真真切切是一个计算器。界...

求一个计算机app的名字
你要找的是不是PhotoMath。PhotoMath解题神器 软件介绍 数学一直是众多学生党的噩梦,尤其是复杂繁多的计算题。在面对令人绞尽脑汁的计算题时你是否也曾幻想过能够分分钟就得出答案呢?这不再是梦想,因为世界上第一个照相式计算器应用已经问世了。解题神器《PhotoMath》对于“学渣们”来说绝对是巨大的福音...

怎样在ipad上使用计算器?
iPad的计算器可以通过控制中心或者搜索功能来快速调出。1. 通过控制中心调出计算器 在iPad的主屏幕上,从底部向上滑动打开控制中心。在控制中心中,可以找到一个圆形图标,上面标有“计算器”的字样。点击这个图标,就可以立即打开计算器应用。2. 通过搜索功能调出计算器 另一种快速调出计算器的方法是使用...

oppo手机计算器在哪里找
首先,打开手机上的软件商店,这是通过访问设备上预装的应用商店。接着,在商店中找到搜索框,输入关键词“计算器”,系统将列出相关应用,其中包括Oppo计算器。Oppo计算器是Oppo手机上的预装应用,提供基本和科学计算功能。这一步骤适用于大多数智能手机,并确保用户可以轻松找到并安装所需的计算器应用。

施甸县15882491044: c语言设计一个简单的计算器程序
屈毓奥美: /* 2013年12月23日 12:43:46 目的:计算器的实现 */ # include <stdio.h> # include <ctype.h> # include <math.h> char get_choice(void); //获取用户输入的选项,并建立目 char get_first(void); //获取用户输入的选项,并剔除错误输入 float get_int(...

施甸县15882491044: c语言如何创建一个按钮?做计算器用 -
屈毓奥美: 这是一个简单计算器程序: 1)创建一个对话框的应用 2)向对话框中添加一个编辑框控件和十六个按钮 3)在头文件声明:double m_Num; //记录编辑框中的数据BOOL m_Time; //判断是否为第一次按下数字键char m_Operator; //保存运...

施甸县15882491044: 设计一个简单的计算器程序
屈毓奥美: #include <iostream> using namespace std; int main() { double x,y,s1,s2,s3,s4; char z; cout<<"请输入运算公式:"; cin>>x>>z>>y; s1=x+y; s2=x-y; s3=x*y; s4=x/y; if(z='+') { cout<<"运算结果为:"<<s1<<endl; } else if(z='-') { cout<<"运算结果为...

施甸县15882491044: Java程序 -- 编写一个具有图形界面的计算器程序 -
屈毓奥美: import java.awt.*; import java.awt.event.*; import java.io.*; public class Test implements ActionListener { Frame f = new Frame("一步运算计算器");//创建窗架 TextField[] tf = new TextField[3];Label La1 = new Label("+");Button btn = new ...

施甸县15882491044: 创建一个多功能计算器程序,程序运算界面如图2 - 6所示. 要求: (1)用控件数组设计数字按钮(2)用API函数实现“总在前面效果”注意:存盘时保存在以学号或姓名命名的文件夹下,工程文件名为vbxk2 - 03.vbp,窗体文件名为vbxk2 - 03.frm,文件夹名为vbxk2 - 03. -
屈毓奥美: 要求: (1)用控件数组设计数字按钮 (2)用API函数实现“总在前面效果” 注意:工程文件名为vbxk2-03.vbp,窗体文件名为vbxk2-03.frm,文件夹名为vbxk2-03.

施甸县15882491044: 利用你现有的c语言知识 设计开发一个简易计算器,可进行加、减、乘、除、求余运算. -
屈毓奥美: #include <stdio.h> float numA = 0; float numB = 0; float temp = 0; void calc(){printf("\n");printf("======欢迎使用计算器=====");printf("\n");printf("请输入第一个数:");scanf("%lf",&numA)printf("请输入第二个数:")...

施甸县15882491044: 获取文本框中的文本的方法是什么 - 上学吧普法考试
屈毓奥美: 我之前做的.可以实现10、16进制的任意输入输出转换

施甸县15882491044: 用JAVA实现一个计算器的应用程序 -
屈毓奥美: /** @version 1.32 2004-05-05 @author Cay Horstmann */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Calculator { public static void main(String[] args) { CalculatorFrame frame = new CalculatorFrame(); frame....

施甸县15882491044: C++简单计算器的程序 -
屈毓奥美: #include<iostream>//简单的计算器 using namespace std; int main() { int a,b; char c;//这里变量名只能为char cout<<"计算器"<<endl; cout<<"你想使用哪种计算器(+,-,*,/)"<<endl; cin>>c; switch(c)//这里是对+,-,*,//进行使用(c) ...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网