Friday, August 27, 2010

random



The INT function returns the integer part of a specified number.
Rnd is used to return psuedo-random values. These values may look random but because they use complex mathematical formulas they technically aren't random as they are still predictable.
Each time the program is run the psuedo-random values returned by Rnd are always the same. To overcome this you use randomize to initialise VB's random number generator. To avoid generating the same sequence of psuedo-random values you call randomize before you call Rnd.
To change the different values it can choose from you change the highest and lowest values. In the following code the highest is 10 and the lowest is 1. This means that it can choose a value between 1 and 10. You put it after: Handles Button1.Click

Thursday, August 26, 2010

timer


Hi LO Guessing Game





1) How many objects are referred to? What are they?
There's one variable, two text boxes and two buttons.

2) What is the name of the variable referred to?
secretnum

3) What are the three text options that appear in textbox1?
higher, lower and correct.

4) What do you think this code does?
You would enter a number in one of the text boxes and click a button but if the random number is higher, lower or if it's correct the other text box would tell you.

5) Well actually you should replace TextBox2 with a label and that means replacing TextBox2 in the code with Label1. This means that you can't enter something in the wrong textbox which is what I was doing which is why it wasn't working. In the original code I was entering a number where it shouldn't have been entered which is why you change it into a label because you can't enter a number in a label. The first button checks your answer and the second button resets it.

Wednesday, August 18, 2010

variables




A string is a sequence of characters. A string is like a data type storing a sequence of data values, usually bytes, where these usually stand for characters. That means that binary string and byte string are used to describe strings where the data they store but does not have to be text.


Integer variables are variables that must take an integer value; a whole number like 1 or 2. A special kind of integer variables is binary variables. Integer variables however will make the program more complex, making it take more time to solve things..

Thursday, August 12, 2010

and, or, not.

greater than, less than, equal too, less then and equal too.
^relational data operators !

a desk check is a way of manually stepping through a program and monitoring the change in variables.

test program.
tries to simulate unexpected values.

sample data.
data you expect will appear. to test its capability to work, stress test.

hertz - per second.
giga - bigger than mega, 1 000 000 000
mega - 1 000 000

when 'not' is the case, it is true ?

Friday, August 6, 2010

happy and sad / variables

and here is just some random code on variables, it really belongs somewhere else, but i'll fix that later !

we just were trying out some simple games here. the happy sad game is pretty simple and straightforward :)

Wednesday, August 4, 2010

heads and tails,


The first white box you se is a label but in the text part of the properties I've put a whole heap of spaces and made sure the background colour is white. The second box is a button where the text has been changed to 'CHECK'. The final box is a text box where the user can type somehing in. I put the following code into the code of the button.
If TextBox1.Text = "heads" Then Label1.Text = "win"
If TextBox1.Text = "tails" Then Label1.Text = "lose"
The code above is an example of selection. If you misspell heads or tails or use a capital letter then the label will stay the same as the last one.

A solution to this problm would be to use radio buttons because the user wouldn't type in something wrong. To put the radio buttons in I put in the following code:
If Heads.Checked = "true" Then Label1.Text = "win"

If Tails.Checked = "true" Then Label1.Text = "lose"
A user friendly programme should always allow for user input errors