|
i want to know what is the code in visual basic 8 that will examine the shape of a number FROM DIGIT TO DIGIT
example
i have the number 1733
1-7 is an anscendig distance i name "U"
7-3 is descending distance i name "D"
3-3 is equal distance i name "Q"
so the shape of the number is "UDQ"
thank you
george
|
|
|
|
|
memas63 wrote: what is the code
So you have not actually tried anything or read the "How to ask a question" message?
Sounds to me like you just need to write a couple of if statements. How is this a problem?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
i dont know how to start i am 63 years old
thank you
|
|
|
|
|
Reading the documentation helps. This[^] will tell you how to use an if statement.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
i read the example but i want to know how i use the if and then if is a number from one digit to the other
make me the start from the first digit to the second and i will try the rest
thank you
|
|
|
|
|
You cannot iterate over a number. You will have to convert the number to a string and then iterate over the string converting each character to a number and then comparing them
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
please show me the startig code and i will understand better
thank you
|
|
|
|
|
Here's some code that might give you an idea, since it takes a string, iterates through character by character, and tests each character. Obviously your test will be different, but it should get you on the right track. Taken from <a href="http://msdn.microsoft.com/en-us/library/system.string.chars.aspx">MSDN</a>[<a href="http://msdn.microsoft.com/en-us/library/system.string.chars.aspx" target="_blank" title="New Window">^</a>].
<pre lang="vb">Console.Write("Type a string : ")
Dim myString As String = Console.ReadLine()
Dim i As Integer
For i = 0 To myString.Length - 1
If Uri.IsHexDigit(myString.Chars(i)) Then
Console.WriteLine("{0} is a hexadecimal digit.", myString.Chars(i))
Else
Console.WriteLine("{0} is not a hexadecimal digit.", myString.Chars(i))
End If
Next
' The example produces output like the following:
' Type a string : 3f5EaZ
' 3 is a hexadecimal digit.
' f is a hexadecimal digit.
' 5 is a hexadecimal digit.
' E is a hexadecimal digit.
' a is a hexadecimal digit.
' Z is not a hexadecimal digit. </pre>
|
|
|
|
|
thank you for your help i ll try to do it and if i make it will let you know
thanks again
george
|
|
|
|