Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21195

[Help] Stuck on program

$
0
0
numeralProj.zip
I have encountered a block in my programming escapade. The project that I am working on is from a visual basic 6.0 programming book and is a program that opens a data file filled with roman numerals, read to end of file, and outputs the numerals digit form, performs a mathematical operator on them, and then display output. I am also employing the use of subfunctions/subroutines to better organize my program. My Main Problem is that I am having trouble obtaining the correct output. Below are my subs.

ReadRoman - Reads a string which represents a Roman Number, calls GetDigit to convert this Roman Digit into a decimal number, adds this decimal number to the value of the roman number.

GetDigit = Takes a roman digit and returns the decimal value to the caller.

Calculate - Takes the decimal equivalent of both Roman numbers and the operator and computes their combined result. Uses WriteRoman to display the last line of output.

WriteRoman - Takes a decimal number and converts it into a Roman Nubmer. Calls Writedigit in order to accomplish the above.

WriteDigit - Print a Roman Digit

To better explain it, I have included the data file as well as a little preview of what I would like to output.

Output

The First Numer is 1226
The second number is 68
The Operation is +
MCCXXVI + LXVIII = MCCLXXXXIIII (1294)

The DAT file is organized as seen below.

(Start of File)

MCCXXVI
LXVIII
+
MCCXXVI
LXVIII
-
MCCXXVI
XVII
*
DCI
L
MDCIIII
L
*
CCCC
XXXX
-

(End of File)

Here is the code that I have so far.

Code:

Dim numerals As String
Private Function ReadRoman()
End Function
Private Function GetDigit(ByVal Num As String) As Integer
 Select Case Num
    Case "I"
        GetDigit = 1
    Case "V"
        GetDigit = 5
    Case "X"
        GetDigit = 10
    Case "L"
        GetDigit = 50
    Case "C"
        GetDigit = 100
    Case "D"
        GetDigit = 500
    Case "M"
        GetDigit = 1000
End Select
End Function

Private Function WriteRoman()
Call WriteDigit
output.Print Number
End Function
Private Function WriteDigit()
output.Print numerals
End Function

Private Sub calculate_Click()
Input #1, numerals
For i = 1 To Len(numerals)
End Sub

Private Sub Form_Load()
'open file
Open App.Path & "\numerals.dat" For Input As #1
'Do While Not EOF(1)
End Sub

numeralProj.zip

Thank you for your time, and I apologize for any grammatical errors and lack of programming experience.
Attached Files

Viewing all articles
Browse latest Browse all 21195

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>