Those funny ones and zeros in the below post is the phrase “those who can understand binary and those who can’t” converted from ASCII (letters) into binary. You can thank Bob Bemer for that. Don’t know who he is?- go look it up; it’s quite fascinating if your anything like me.
I spent 2 more hours working on VB today, even though we didn’t have a class in it. I used the last half of my PC & Office class (see second post for detailed description of that particular course ;)) and my lunch break to work on that project I mentioned earlier. It had to take 5 inputs from the user, find the largest and smallest, and then display them. For a bonus question he requested that we also find and display the amount of even and odd numbers out of those 5.
First I tried something like this.
If number1 > number2 and number3 and number4 and number5 Then
Console.writeline(”the largest number is: ” & number1)
End If
but once I wrote that out ten times, 5 for finding the highest and 5 for the lowest (well, copy-pasted). . . I guess the computer didn’t like that too much and only decided to work some of the time. I fooled around with it for half an hour before deciding my code was perfectly fine. For example: if I only had one If statement and it turned out to be true it would work. But if I had 10 and the first 4 were false, with the last one out of the first 5 being true then it would get all confused and either not do anything, display the wrong number, or bomb completely.
So I decided to delete most of the code, and try to do the exact same thing only completely different. Harder then it sounds. So I sat there for ten minutes before my buddy Tom gave me a backhanded sort of hint. I sat there for five more minutes just thinking about it before I touched any more code. Once I got it all sorted out though I had it working in about two minutes.
Dim highest as Integer
highest = number1
If number2 > highest Then
highest = number2
End If
. . .and so on. Simple once it’s down on paper- not so simple when you have nothing to go on. . . but what a rush when I finally got it to work.
When can I do that again???
Ii was sort of cool how I calculated the amount of even and odd numbers. It was actually easier then the original problem of finding highest/lowest.
dim even as integer
dim odd as integer
odd = 5
If number1 Mod 2 = 0 then
even = even +1
odd = odd -1
End If
Basically.
psst- Mod calculates the remainder when you divide. Example: 5 mod 3 = 2 and 6 Mod 2 = 0 :). Also, keep in mind I still need to write it to the console. The more you know.
Also, WordPress is deleting all my white space- this post would be more readable if it didn’t auto-delete Tabs and extra lines.

You’d probably like writing posts better with the Rich Text Editor turned off (go to Users->Profile, scroll way down, uncheck the box, save…) and then you can plunk html in there directly.
If you want to indent code, wrap it in blockquote tags, or there’s even a
tag. (Don't forget the ending.)I’m sure Dad is grinning.
Wow, that totally ate the code tag, even with spaces in it.
Will you please send me your mailing address. Your Uncle Andrew and I have something we want to send you.
I’ve put my email in the about section for you.
The one on the right side, not the one that’s tabed.
I confess to finding this layout very difficult to read, but I’m enjoying your code chatter.
That was the metric I’d come up with too.
In your first if all of the ands get evaluated as operators. So, you can write something like
if A and B then
which means if A is true and B is true.
Yours said
if number1 is greater than number2 and number3 is true and number4 is true and number5 is true then
…
Good to see that you thought of a way around it