有代码么 给大家看看 谢谢喽
狂风扫落叶,扫把都失业!拍卖QQ:559372
double类型用FABS
int 类型用ABS
#include<stdio.h>
#include<math.h>
void main()
{
int i = -3, a;
float j = -2, b; //本行改成 float j = -2.5, b; 您再试试!
a = fabs (i); //此处成功是fabs()形参兼容int型的结果。
b = abs (j); //此处侥幸成功是因为(-2)无小数部分。
printf("%d, %f\n", a, b);
getch ();
}
但这样也能得到正确结果呀.错啦!!!
Option Explicit
Dim zifu1 As String, zifu2 As String, linshizifu As String * 1, anniu%, num1#, num2#, result#
Private Sub Command1_Click()
linshizifu = Command1.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command10_Click()
linshizifu = Command10.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command11_Click()
num1 = Val(zifu1)
num2 = Val(zifu2)
Select Case anniu
Case 1
result = num1 + num2
Picture1.Print "=" & result
Case 2
result = num1 - num2
Picture1.Print "=" & result
Case 3
result = num1 * num2
Picture1.Print "=" & result
Case 4
If num2 = 0 Then
Picture1.Print " 输入错误.被除数不能为零"
Else
result = num1 / num2
Picture1.Print "=" & result
End If
Case 5
result = num1 ^ num2
Picture1.Print "=" & result
End Select
End Sub
Private Sub Command12_Click()
linshizifu = Command12.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command13_Click()
Picture1.Print Command13.Caption;
anniu = 1
End Sub
Private Sub Command14_Click()
Picture1.Print Command14.Caption;
anniu = 4
End Sub
Private Sub Command15_Click()
Picture1.Print Command15.Caption;
anniu = 3
End Sub
Private Sub Command16_Click()
Picture1.Print Command16.Caption;
anniu = 2
End Sub
Private Sub Command17_Click()
zifu1 = ""
zifu2 = ""
anniu = 0
Picture1.Cls
End Sub
Private Sub Command18_Click()
Dim a%
a = Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE", 1)
End Sub
Private Sub Command19_Click()
Dim a%
a = Shell("regedit.exe", 1)
End Sub
Private Sub Command2_Click()
linshizifu = Command2.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command20_Click()
Dim a%
a = Shell("C:\Program Files\Outlook Express\msimn.exe", 1)
End Sub
Private Sub Command21_Click()
Dim a%
a = Shell("C:\WINDOWS\explorer.exe", 1)
End Sub
Private Sub Command22_Click()
Dim a%
a = Shell("C:\Program Files\Windows Media Player\wmplayer.exe", 1)
End Sub
Private Sub Command23_Click()
Dim a%
a = Shell("C:\WINDOWS\system32\taskmgr.exe", 1)
End Sub
Private Sub Command24_Click()
Dim a%
a = Shell("C:\WINDOWS\system32\notepad.exe", 1)
End Sub
Private Sub Command25_Click()
Dim a%
a = Shell("C:\WINDOWS\pchealth\helpctr\binaries\msconfig.exe", 1)
End Sub
Private Sub Command26_Click()
linshizifu = Command26.Caption
Picture1.Print linshizifu;
anniu = 5
End Sub
Private Sub Command27_Click()
num1 = Val(zifu1)
If num1 >= 0 Then
result = Sqr(num1)
Picture1.Print "开方=" & result
Else
Picture1.Print " 负数不能开方"
End If
End Sub
Private Sub Command28_Click()
linshizifu = "-"
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command3_Click()
linshizifu = Command3.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command4_Click()
linshizifu = Command4.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command5_Click()
linshizifu = Command5.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command6_Click()
linshizifu = Command6.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command7_Click()
linshizifu = Command7.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command8_Click()
linshizifu = Command8.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Command9_Click()
linshizifu = Command9.Caption
Picture1.Print linshizifu;
If anniu = 0 Then
zifu1 = zifu1 & linshizifu
Else
zifu2 = zifu2 & linshizifu
End If
End Sub
Private Sub Form_Load()
anniu = 0
End Sub
Private Sub 打开cmd_Click()
Dim a%
a = Shell("cmd.exe", 1)
End Sub
————————————————————————————————————————————
[此贴子已经被作者于2006-12-31 13:49:15编辑过]