VBnbsp;编个加减运算的小程序
‘只修改2个地方,其他不变nbsp;:Privatenbsp;Subnbsp;Command1_Click()nbsp;Dimnbsp;tempnbsp;Asnbsp;Stringnbsp;Opennbsp;Text1.Textnbsp;Fornbsp;Inputnbsp;Asnbsp;#1nbsp;Opennbsp;Text2.Textnbsp;Fornbsp;Outputnbsp;Asnbsp;#2nbsp;Donbsp;Whilenbsp;Notnbsp;EOF(1)nbsp;Linenbsp;Inputnbsp;#1,nbsp;tempnbsp;Dimnbsp;Snbsp;Asnbsp;String,nbsp;Anbsp;Dnbsp;=nbsp;CDbl(Val(Text3.Text))nbsp;Snbsp;=nbsp;tempnbsp;Anbsp;=nbsp;Split(S,nbsp;“A“)nbsp;Fornbsp;inbsp;=nbsp;1nbsp;Tonbsp;UBound(A)nbsp;Ifnbsp;Len(A(i))nbsp;amp;gt;nbsp;0nbsp;Thennbsp;A(i)=nbsp;nbsp;Dnbsp;*nbsp;3.141592nbsp;/nbsp;360nbsp;*nbsp;val(A(i))nbsp;nbsp;‘修改处Endnbsp;Ifnbsp;Nextnbsp;tempnbsp;=join(a,“Y“)nbsp;nbsp;‘关键修改处Printnbsp;#2,nbsp;tempnbsp;Loopnbsp;Closenbsp;#1nbsp;Closenbsp;#2nbsp;form4.Shownbsp;Unloadnbsp;Menbsp;Endnbsp;Sub
如何用EXCEL编个计算的小程序
如果运算不是很复杂,用excel自带的公式就可以完成啦. 1.将计算逻辑写清楚 2.发贴 3.等高手指点迷津 4.^_^
用C语言编一个简单的计算器小程序
#include#include main(){ double data1,data2; //把他们设成double就可以做浮点运算了 char op; do{ printf(“please enter the expression:”); scanf(“%lf %c %lf”,&data1,&op,&data2); //在他们之间加空格就可以打无限空格了 switch(op){ case’+’:printf(“%.2lf+%.2lf=%.2lf\n”,data1,data2,data1+data2);break; case’-‘:printf(“%.2lf-%.2lf=%.2lf\n”,data1,data2,data1-data2);break; case’*’:printf(“%.2lf*%.2lf=%.2lf\n”,data1,data2,data1*data2);break; case’/’:if(!data2)printf(“division by zsro!\n”); else printf(“%.2lf/%.2lf=%.2lf\n”,data1,data2,data1/data2);break; default:printf(“unkown operator!\n”); } printf(“do you want to continue(y/n or y/n)”); fflush(stdin);//这是清掉之前的回车键用的 }while(toupper(getchar())==’y’);//你的底这样好这个应该没有问题了吧。 }
如何编写JAVA计算器小程序
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String str = br.readLine();
String str1 = br.readLine();
String str2 = br.readLine();
int num1 = Integer.parseInt(str);
int num2=Integer.parseInt(str2);
if(str1.equals(“*”)){
System.out.println(num1*num2);
}
if(str1.equals(“+”)){
System.out.println(num1+num2);
}
if(str1.equals(“-“)){
System.out.println(num1-num2);
}
if(str1.equals(“/”)){
System.out.println(num1/num2);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
求一个用c++6.0编的MFC窗口计算器小程序,最简单的就行
建立基于对话框的MFC程序,将默认的控件删除.加入两个输入框,并打开类向导绑定两个变量,添加显示的控件,绑定变量.添加加减等的按钮控件.并作相应的消息相应,就是实现加减等.很简单的.最后再计算的消息相应函数中Update();希望对你有用.
VB 编个加减运算的小程序
‘只修改2个地方,其他不变 : Private Sub Command1_Click() Dim temp As String Open Text1.Text For Input As #1 Open Text2.Text For Output As #2 Do While Not EOF(1) Line Input #1, temp Dim S As String, A D = CDbl(Val(Text3.Text)) S = temp A = Split(S, “A”) For i = 1 To UBound(A) If Len(A(i)) > 0 Then A(i)= D * 3.141592 / 360 * val(A(i)) ‘修改处 End If Next temp =join(a,”Y”) ‘关键修改处 Print #2, temp Loop Close #1 Close #2 form4.Show Unload Me End Sub
用C 语言编个计算器小程序 (要求如下) 万分感谢 (如果可以 请加注释)
#includevoid main() { float a,b,y; char ch; char s=’c’; while(1) { if(s==’c’||s==’C’) { system(“cls”); printf(“please input your operator:”); scanf(“%f%c%f”,&a,&ch,&b); switch(ch) { case ‘+’: y=a+b;break; case ‘-‘: y=a-b;break; case ‘*’: y=a*b;break; case ‘/’: y=a/b;break; } printf(“%.2f%c%.2f=%.4f\n”,a,ch,b,y); printf(“C qingping,R tuichu :”); scanf(“%c”,&s); } else exit(0); } }
求助一个很简单的DELPHI计算小程序
qry为一查询表.1.读到c qry.sql.text:=’select c from BH.mdb where id=:id’; //假设与字段id对应,读c qry.Parameters.ParamByName(‘pym’).Value:=d; qry.open; c:=qry.fieldbyname(‘c’).asinteger;2.这样就可以利用公式了d=a+c*b.这是一个结果.如果数据库中的多条记录要输出一行一行的.也不难啊.可以用form的canvas属性在上面写.如果要好写一点.用一上listbox或memo一行一行的写.也行.如果还不会.把你的表发到我的邮箱dj1893@163.com
油耗计算哪个小程序好
我一直在用小熊油耗APP,觉得比较好用,良心推荐.
新手求教一个 java 四则运算小程序…
java源文件如下 Calc.java:
import javax.swing.JApplet;
import javax.swing.JTextArea;
public class Calc extends JApplet {
public void init() {
double first = Double.parseDouble(getParameter(“first”));
double second = Double.parseDouble(getParameter(“second”));
char operator = getParameter(“operator”).charAt(0);
double result = 0;
switch(operator) {
case ‘+’: result = first + second; break;
case ‘-‘: result = first – second; break;
case ‘*’: result = first * second; break;
case ‘/’: result = first / second; break;
}
JTextArea text = new JTextArea(3,100);
text.setEditable(false);
String a = “************************”;
String s = String.format(“%.2f %c %.2f = %.2f”,first,operator,second,result);
text.append(a+”\n”);
text.append(s+”\n”);
text.append(a+”\n”);
add(text);
}
}
html文件如下 a.html:
<html>
<title>Calc</title>
<applet code=”Calc.class” width=200 height=100>
<param name=”first” value=”1.2″>
<param name=”second” value=”2.4″>
<param name=”operator” value=”+”>
</applet>
</html>
将java文件编译后得到的Calc.class文件与html文件放在同一个目录下,然后用浏览器打开那个html文件就能看到了。当然你的浏览器得支持java才行。
普通的java代码如下 Calc.java
public class Calc extends JApplet {
public static void main(String[] args) {
double first = 1.2;
double second = 2.4;
char operator = ‘+’;
double result = 0;
switch(operator) {
case ‘+’: result = first + second; break;
case ‘-‘: result = first – second; break;
case ‘*’: result = first * second; break;
case ‘/’: result = first / second; break;
}
String a = “************************”;
String s = String.format(“%.2f %c %.2f = %.2f”,first,operator,second,result);
System.out.println(a);
System.out.println(s);
System.out.println(a);
}
}