rogram Description: Write a program that has four sub procedures that will calculate and print out a table of numbers 0 to 17 in decimal, hex, octal, and binary notation.
VERSION 5.00 Begin VB.Form Form1 Caption = quot;Form1" ClientHeight = 6015 ClientLeft = 60 ClientTop = 345 ClientWidth & = 8145 LinkTopic = quot;Form1" ScaleHeight & = 6015 ScaleWidth = 8145 StartUpPosition = 3& 'Windows Default Begin VB.ListBox List2 Height = 4155 Left = 6000 TabIndex & = 8 Top = 1440 Width & = 1695 End Begin VB.ListBox List8 Height = 4155 Left = 4200 TabIndex & = 7 Top = 1440 Width & = 1695 End Begin VB.ListBox List16 Height = 4155 Left = 2400 TabIndex & = 6 Top = 1440 Width & = 1695 End Begin VB.ListBox List10 Height = 4155 Left = 600 TabIndex & = 5 Top = 1440 Width & = 1695 End Begin VB.Label Label2 Caption = quot;BASE" Height = 255 Left = 720 TabIndex & = 4 Top = 360 Width & = 1935 End Begin VB.Label Label1 Alignment = 2& 'Center Caption = quot;2" Height = 375 Index & = 3 Left = 6120 TabIndex & = 3 Top = 840 Width & = 1455 End Begin VB.Label Label1 Alignment = 2& 'Center Caption = quot;8" Height = 375 Index & = 2 Left = 4320 TabIndex & = 2 Top = 840 Width & = 1455 End Begin VB.Label Label1 Alignment = 2& 'Center Caption = quot;16" Height = 375 Index & = 1 Left = 2520 TabIndex & = 1 Top = 840 Width & = 1455 End Begin VB.Label Label1 Alignment = 2& 'Center Caption = quot;10" Height = 375 Index & = 0 Left = 720 TabIndex & = 0 Top = 840 Width & = 1455 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Sub PrintDecimal() & For i = 0 To 17 & List10.AddItem (i) & Next i End Sub
Sub PrintHex() & For i = 0 To 17 & List16.AddItem (Hex(i)) & Next i End Sub
Sub PrintOctal() & For i = 0 To 17 & List8.AddItem (Oct(i)) & Next i End Sub
' returns binary presentation of a number q of length l filling the initial positions with zeros. Function Binary(ByVal q As Integer, ByVal l As Integer) & Dim s As String & Dim i, rest As Integer & & i = q & s = "" & While i > 0 rest = i Mod 2 If rest = 0 Then s = "0" + s Else s = "1" + s End If i = (i - rest) / 2 & Wend & & Binary = String(l - Len(s), "0") + s End Function Sub PrintBinary() & For i = 0 To 17 & List2.AddItem (Binary(i, 5)) & Next i End Sub Private Sub Form_Load() PrintDecimal PrintHex PrintOctal PrintBinary End Sub
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment