ImageVerifierCode 换一换
格式:DOC , 页数:13 ,大小:19.22KB ,
资源ID:2787209      下载积分:20 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-2787209.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(vb分数类和向量类之间运算程序(Arithmetic program between VB fractional class and vector class).doc)为本站会员(dreamzhangning)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

vb分数类和向量类之间运算程序(Arithmetic program between VB fractional class and vector class).doc

1、vb分数类和向量类之间运算程序(Arithmetic program between VB fractional class and vector class)- score class operationThe metabolic score class class modulePrivate, a, B, member variables of the fractional classPublic Function fgcd (a, b) for the common denominatorDim, C, x, yIf a 0 And b 0 Then X = Abs (a): y = A

2、bs (b)While y 0C = x - y * Int (x / y): x = y: y = CWendFgcd = xElseIf a = 0 And B 0 ThenFgcd = Abs (b)ElseIf a 0 And B = 0 ThenFgcd = Abs (a)ElseIf, a = 0, And, B = 0, ThenFgcd = 0ElseEnd IfEnd FunctionPublic Sub CSET (x, y) fractional class constructor 1 (two integers converted to fractions)A = x:

3、, B = yEnd SubPublic Function cshow () displays the scoresIf a * b 0 ThenCshow = Abs (a) / fgcd (Abs (a), Abs (b) & “/ “ (Abs (b) / fgcd (Abs (a), Abs (b)ElseIf a * B “/“) 0A = Val (dtxt (s, “/“, 1): B = Val (dtxt (s, “/“, 2)ElseA = Val (s): B = 1End IfEnd SubLong form codePrivate Sub Cmdys_Click ()

4、 command click buttonDim I, CL1 As New Class1, Cl2 As New Class1, CL3 As New Class1, nFor I = 0, To, Combo1.ListCount - 1If Combo1.Text = Combo1.List (I) Then Exit ForNext II = I + 1: cl1.cset1 Text1.Text: cl2.cset1 Text2.TextIf I = 1 ThenSet CL3 = FADD (CL1, Cl2): Label1.Caption = cl3.cshowElseIf I

5、 = 2 ThenSet CL3 = fsub (CL1, Cl2): Label1.Caption = cl3.cshowElseIf I = 3 ThenSet CL3 = FTIM (CL1, Cl2): Label1.Caption = cl3.cshowElseIf I = 4 ThenSet CL3 = fdiv (CL1, Cl2): Label1.Caption = cl3.cshowElseIf I = 5 ThenN = Val (Text2.Text): Set CL3 = fpow (CL1, n): Label1.Caption = cl3.cshowElseEnd

6、IfEnd SubPrivate Sub Form_Load () form loadingDim IFor I = 1 To 5Combo1.AddItem Choose (I, “+“, “-“, “*“, “/“, “)Next ICombo1.Text = “+“End SubPublic Function FADD (CL1 As Class1, Cl2 As Class1) As Class1 fractional additionDim, Cl, As, New, Class1Call cl.cset (cl1.re (1) * cl2.re (2) + cl1.re (2) *

7、 cl2.re (1), cl1.re (2) * cl2.re (2)Set, FADD = cl:, Set, CL = NothingEnd FunctionPublic Function fsub (CL1 As Class1, Cl2 As Class1) As Class1 class subtractionDim, Cl, As, New, Class1Call cl.cset (cl1.re (1) * cl2.re (2) - cl1.re (2) * cl2.re (1), cl1.re (2) * cl2.re (2)Set, fsub = cl:, Set, CL =

8、NothingEnd FunctionPublic Function FTIM (CL1 As Class1, Cl2 As Class1) As Class1 fractional multiplicationDim, Cl, As, New, Class1Call cl.cset (cl1.re (1) * cl2.king (1), cl1.re (2) * cl2.re (2)set ftim = cl: set cl = nothingend functionpublic function fdiv (cl1 as class1, cl2 as class1) as class1s

9、分数类除法dim cl as new class1call cl.cset (cl1.re (1) * cl2.re (2), cl1.re (2) * cl2.re (1)set fdiv = cl: set cl = nothingend functionpublic function fpow (cl as class1, n) as class1s 分数类乘方dim cl1 as new class1, a1, a2if n = 0 thencall cl1.cset (pow1 (cl.re (1), (n), pow1 (cl.re (2, n)elsecall cl1.cset

10、(pow1 (cl.re (2) - (n), pow1 (cl.re (1) - (n)end ifset fpow = cl1: set cl1 = nothingend functionpublic function pow1 (a, n) is 整数的乘方dim i, f: f = 1for i = 1 to nf = f *next thepow1 = fend function向量类的运算向量类中的代码private x, y, z is 向量类中成员变量public sub c.s.e.t. (a1, a2, a3) is 设置向量类中的成员变量的值x = y = a1: a2:

11、 z = a3end subpublic function (s) 返回向量类的成员变量的值if s = 1 thenking = xelseif s = 2 thenre = yelseif s = 3 thenking = zelseend ifend functionpublic function cshow (r) is 显示向量类中成员变量的值if r = 1 thencshow = “(“ & “,“ & x & y & z & “,“ & “)“elseif r = 2 thencshow = x & u & iif (y = 0, “+“, “-“) & abs (y) & j

12、 & iif (z = 0, “+“, “-“) & abs (z) & “k“elseend ifend function主窗体运算代码options explicitprivate sub cmdjs _ click () is 命令按钮单击dim cl1 as new class2, cl2 as new class2, cl3 as new class2, s1, s2, xs1 = text1. text: s2 = text2. textcall cl1.cset (val (dtxt (s1, “,“, 1), val (dtxt (s1, “,“, 2), val (dtxt

13、(s1, “,“, 3)call cl2.cset (val (dtxt (s2, “,“, 1), val (dtxt (s2, “,“, 2), val (dtxt (s2, “,“, 3)set cl3 = vadd (cl1, cl2): label1. caption = cl3.cshow (1) & “,“ & cl3.cshow (2) & “set cl3 = vsub (cl1, cl2): label2. caption = cl3.cshow (1) & “,“ & cl3.cshow (2) & “set cl3 = vmul1 (cl1, cl2): label3.

14、 caption = cl3.cshow (1) & “,“ & cl3.cshow (2) & “x = cmul2 (cl1, cl2): label4. caption = xset cl3 = vmul3 (cl1, cl2.re (1): label5. caption = cl3.cshow (1) & “,“ & cl3.cshow (2) & “end subpublic function vadd (cl1 as class2, cl2 as class2) as class2s 向量的加法dim cl3 as new class2call cl3.cset (cl1.re

15、(1) + cl2.re (1), cl1.re (2) + cl2.re (2), cl1.re (3) + cl2.re (3)set vadd = cl3: set cl3 = nothingend functionpublic function vmul1 (cl1 as class2, cl2 as class2) as class2s 向量的向量积dim cl3 as new class2call cl3.cset (cl1.re (2) * cl2.re (3) - cl1.re (3) * cl2.re (2), cl1.re (3) * cl2.re (1) - cl1.re

16、 (1) * cl2.re (3), cl1.re (1) * cl2.re (2) - cl1.re (2) * cl2.re (1)设置:设置 vmul1 = CL3 CL3 =没有端功能公共职能 VSUB(CL1 Cl2 为 2,2)作为“向量的减法 2昏暗的 CL3新班叫 CL3。CSET(CL1。再(1)-(1)Cl2。再次,CL1。再(2)-(2)Cl2。再次,CL1。再(3)氯气。再(3) )集 VSUB = CL3:集 CL3 =没有端功能“窗体加载私有子 form_load()“=”、 “文本:中文本=“2。- 8,8”端子公共功能 cmul2(CL1 Cl2 为 2,2)的向量的数量积定义 x:x = CL1。再(1)2。再(1)+ CL1。再(2)*氯气。再(2)+(3)* CL1,Cl2, (3):cmul2 = x端功能公共功能 vmul3(CL1 为 2,N)为 2的向量的数乘昏暗的 CL3新班叫 CL3。CSET(CL1。再(1)N,CL1。再(2)N,CL1。再(3)* N)设置:设置 vmul3 = CL3 CL3 =没有端功能

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报