用C编写Windows应用程序,计算12310的值

齐昌东 2019-12-21 20:32:00

推荐回答

熟悉C的话,建议看一个系列视频,叫《C语言也能干大事》,讲用C+WindowSDK来写GUI程序,每集几十分钟,看完前三集就算入门了,写点计算器神马的没问题。看完这个系列视频,想深入搞一下,《Windows程序设计》和《Windows核心编程》是必须要看的。MFC用的人还是蛮多的,而且很多老师都认为C++是最适合拿来写Windows桌面应用程序的。不过MFC学习难度并不小,学习成本不算低,而且现在的趋势是全面网络化,B/S大行其道,花这个功夫值不值还是要想要一下。
齐昌广2019-12-21 20:40:14

提示您:回答为网友贡献,仅供参考。

其他回答

  • .net的vsc++不是很好用吗。
    米增春2019-12-21 20:57:22

相关问答

给你一个参考,希望不要被吞了当晚餐importjava.awt.BorderLayout;importjava.awt.GridLayout;importjava.awt.event.MouseEvent;importjava.awt.event.MouseListener;importjava.text.DecimalFormat;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JTextField;publicclassCalculator{//计算器面板privateJFramef=newJFrame"Calculator";//输入面扳privateJPanelinputPanel=newJPanel;//加减乘除面板privateJPaneloperationPanel=newJPanel;//数字面板privateJPanelbuttonsPanel=newJPanel;//输入数据文本框privateJTextFieldinput=newJTextField20;//退格键privateJButtonbackspace=newJButton"BackSpace";//清空privateJButtonCE=newJButton"CE";//删除privateJButtonC=newJButton"C";//四则运算符号键privateJButtonadd=newJButton"+";privateJButtonsub=newJButton"-";privateJButtonmul=newJButton"*";privateJButtondiv=newJButton"/";//小数点privateJButtondecimal=newJButton".";//等号privateJButtonequal=newJButton"=";//数字键privateJButtonzero=newJButton"0";privateJButtonone=newJButton"1";privateJButtontwo=newJButton"2";privateJButtonthree=newJButton"3";privateJButtonfour=newJButton"4";privateJButtonfive=newJButton"5";privateJButtonsix=newJButton"6";privateJButtonseven=newJButton"7";privateJButtoneight=newJButton"8";privateJButtonnine=newJButton"9";privateStringnum1="";//保存第一个运算数字privateStringoperator="";//保存运算符号publicstaticvoidmainStringargs{newCalculator;//new计算器实例}publicCalculator{//添加组件,布局inputPanel.addinput;f.addinputPanel,BorderLayout.NORTH;operationPanel.addbackspace;operationPanel.addCE;operationPanel.addC;f.addoperationPanel,BorderLayout.CENTER;buttonsPanel.addadd;buttonsPanel.addsub;buttonsPanel.addmul;buttonsPanel.adddiv;buttonsPanel.addone;buttonsPanel.addtwo;buttonsPanel.addthree;buttonsPanel.addzero;buttonsPanel.addfour;buttonsPanel.addfive;buttonsPanel.addsix;buttonsPanel.adddecimal;buttonsPanel.addseven;buttonsPanel.addeight;buttonsPanel.addnine;buttonsPanel.addequal;buttonsPanel.setLayoutnewGridLayout4,4;f.addbuttonsPanel,BorderLayout.SOUTH;//注册各个组件监听事件backspace.addMouseListenernewOperationMouseListener;CE.addMouseListenernewOperationMouseListener;C.addMouseListenernewOperationMouseListener;decimal.addMouseListenernewOperationMouseListener;equal.addMouseListenernewOperationMouseListener;//注册四则运算监听add.addMouseListenernewCalcMouseListener;sub.addMouseListenernewCalcMouseListener;mul.addMouseListenernewCalcMouseListener;div.addMouseListenernewCalcMouseListener;//注册数字监听事件zero.addMouseListenernewNumberMouseListener;one.addMouseListenernewNumberMouseListener;two.addMouseListenernewNumberMouseListener;three.addMouseListenernewNumberMouseListener;four.addMouseListenernewNumberMouseListener;five.addMouseListenernewNumberMouseListener;six.addMouseListenernewNumberMouseListener;seven.addMouseListenernewNumberMouseListener;eight.addMouseListenernewNumberMouseListener;nine.addMouseListenernewNumberMouseListener;f.setVisibletrue;f.pack;f.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE;}privateclassNumberMouseListenerimplementsMouseListener{publicvoidmouseClickedMouseEvente{ifinput.getText.trim.equals"0"{//如果文本框已经是0,结果还是0input.setTextJButtone.getSource.getText.trim;}else{//否则的话,把0添加到后面,譬如文本框是1,结果就为10input.setTextinput.getText.concatJButtone.getSource.getText.trim;}}publicvoidmouseEnteredMouseEvente{}publicvoidmouseExitedMouseEvente{}publicvoidmousePressedMouseEvente{}publicvoidmouseReleasedMouseEvente{}}privateclassCalcMouseListenerimplementsMouseListener{//如果输入的是运算符号,保存第一个结果和运算符号publicvoidmouseClickedMouseEvente{num1=input.getText.trim;input.setText"";operator=JButtone.getSource.getText.trim;}publicvoidmouseEnteredMouseEvente{}publicvoidmouseExitedMouseEvente{}publicvoidmousePressedMouseEvente{}publicvoidmouseReleasedMouseEvente{}}privateclassOperationMouseListenerimplementsMouseListener{publicvoidmouseClickedMouseEvente{ife.getSource==backspace{//退格键,删除一个直到没有字符删除StringinputText=input.getText;ifinputText.length>0{input.setTextinputText.substring0,inputText.length-1;}}elseife.getSource==C{input.setText"0";//C,清空所有运算数字和符号num1="";}elseife.getSource==CE{input.setText"0";//CE-->将文本框置为0}elseife.getSource==decimal{Stringtext=input.getText.trim;//如果按了小数点,如果文本框已经有小数点,不做任何操作,否则在结果后面加上小数点iftext.indexOf"."==-1{input.setTexttext.concat".";}}elseife.getSource==equal{//如果是等号if!operator.trim.equals""{if!input.getText.trim.equals""{doubleresult=0D;ifoperator.equals"+"{//执行加法运算result=Double.parseDoublenum1+Double.parseDoubleinput.getText.trim;}elseifoperator.equals"-"{//减法运算result=Double.parseDoublenum1-Double.parseDoubleinput.getText.trim;}elseifoperator.equals"*"{//乘法运算result=Double.parseDoublenum1*Double.parseDoubleinput.getText.trim;}elseifoperator.equals"/"{//除法运算result=Double.parseDoublenum1/Double.parseDoubleinput.getText.trim;}//格式化最终结果,保留两位小数点input.setTextnewDecimalFormat"0.00".formatresult;}}}}publicvoidmouseEnteredMouseEvente{}publicvoidmouseExitedMouseEvente{}publicvoidmousePressedMouseEvente{}publicvoidmouseReleasedMouseEvente{}}。