Any kind of help with do
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
Hey all i'm new to turing .. i really wana learn alot .. because i am taking a computer programming corse for grade 10 at the moment and i wana learn some stuff my teacher wont tell me.
here is a little list if anyone can help me with it ...
1) Compiling
2) how to make a mouse being able to select things instead of typing
3) when you type a password for a loop to stop how it will appear in * (stars) so other people cannot see the password ( sort of like what hotmail does)
4) how to make lines ( no like a turing help i need special help for that i dont really understand it)
if someone can please help that would be soo great thanks alot!
Archived topic from Iceteks, old topic ID:2825, old post ID:23134
here is a little list if anyone can help me with it ...
1) Compiling
2) how to make a mouse being able to select things instead of typing
3) when you type a password for a loop to stop how it will appear in * (stars) so other people cannot see the password ( sort of like what hotmail does)
4) how to make lines ( no like a turing help i need special help for that i dont really understand it)
if someone can please help that would be soo great thanks alot!
Archived topic from Iceteks, old topic ID:2825, old post ID:23134
Any kind of help with do
Hello. I'll see what I can do for the turing help. First off, if you want to compile your programs into running executable files (.EXE files), what you need to do is this. You need the dos version of turing in order to use this. In windows, go to the C:prompt from the run section (You know, start menu, -> run to get to the c prompt). Then when you're there, type command.com in the box and press enter. The dos c:prompt will pop up. Type in the path where your turing file is, for example C: uring. When you are in the folder where your file is, type COMPILE FILENAME.T where filename is the name of the file you want to compile (.t part is the extension, usually you save your turing files at .t's). Oh, by the way, you don't need to put the letters in caps (that was just to highlight).
Archived topic from Iceteks, old topic ID:2825, old post ID:23157
Archived topic from Iceteks, old topic ID:2825, old post ID:23157
Any kind of help with do
I'm just gonna break up those four questions so that it's not just one big chunk. The second question about using mice might be a little bit more tricky. It is essential that you learn LOOPS, IF THEN ELSE, AND MOUSEWHERE before you can do this. Also, a knowledge in character graphics/pixel graphics/import graphics will help as well. the command to use the mouse is called MOUSEWHERE (x, y, btn), where X is the x coordinate of the pointer, y is the y coordinate of the pointer and btn is the button value (Where it is given a value of 0 when it is not pressed and a value of 1 when it is pressed). Now, in order to keep the mouse working, you must have it in an infinite loop. For example:
LOOP
MOUSEWHERE (X, Y, BTN)
END LOOP
Try that out just to get the feel for the mouse (This will give you a program where the cursor moves around the screen) I trust you know how to stop inifinte loops when a program is executed (CTRL + BREAK if you didn't know ). Now, to create something you can select with the mouse (Like a button), you will need to know of conditional statements (IF, THEN, ELSE). If you haven't learned this concept yet, turn back now because you might get confused. Here's how I would do it
LOOP
MOUSEWHERE (X, Y, BTN)
DRAWFILLBOX (20,20,40,40,5)
IF BTN = 1 AND X >= 20 AND Y >= 20 AND X <= 40 AND Y <= 40 THEN
%This conditional statement says that if the mouse button is clicked within the drawn %box, (hence the boundaries) it will go through this statement, if not, if does nothing
END IF
END LOOP
This might appear to be confusing but once you learn conditional statements, this is a piece of cake.
Archived topic from Iceteks, old topic ID:2825, old post ID:23158
LOOP
MOUSEWHERE (X, Y, BTN)
END LOOP
Try that out just to get the feel for the mouse (This will give you a program where the cursor moves around the screen) I trust you know how to stop inifinte loops when a program is executed (CTRL + BREAK if you didn't know ). Now, to create something you can select with the mouse (Like a button), you will need to know of conditional statements (IF, THEN, ELSE). If you haven't learned this concept yet, turn back now because you might get confused. Here's how I would do it
LOOP
MOUSEWHERE (X, Y, BTN)
DRAWFILLBOX (20,20,40,40,5)
IF BTN = 1 AND X >= 20 AND Y >= 20 AND X <= 40 AND Y <= 40 THEN
%This conditional statement says that if the mouse button is clicked within the drawn %box, (hence the boundaries) it will go through this statement, if not, if does nothing
END IF
END LOOP
This might appear to be confusing but once you learn conditional statements, this is a piece of cake.
Archived topic from Iceteks, old topic ID:2825, old post ID:23158
Any kind of help with do
The third question, I'll have to think about. I haven't used turing in awhile, but it will come back to me. For the fourth question, I'm not sure what it is that you want. Do you want to know how to draw a line? If so, the command is DRAWLINE (x, y, x2, y2, color). This statement draws a dot at X, Y then it draws another dot at X2, Y2 then the command simply joins both of them together. X Y are your first pair of coordinates, such as 20 and 78 where as X2 and Y2 are your second pair of coordinates 98 and 105. They just join together and use the color (numerical value) that you speficy. In order to use this successfully, you will need to set up a setscreen first. The coding for that is:
setscreen ("graphics:v16")
You need this in order to change the graphics set. Seeing as turing sets up ASCII characters by default, it is essential that this be put at the start iof your program or you will get a runtime error. Anyways, hope that works for you
Archived topic from Iceteks, old topic ID:2825, old post ID:23159
setscreen ("graphics:v16")
You need this in order to change the graphics set. Seeing as turing sets up ASCII characters by default, it is essential that this be put at the start iof your program or you will get a runtime error. Anyways, hope that works for you
Archived topic from Iceteks, old topic ID:2825, old post ID:23159
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
thanks for the help i understand compile FULLY just with the line not really
the password you dont remeber and i dont blame you and the mouse i copy and pasted that and it didnt work .. the BTN was sayin it wont work .. if theres anyway you can take it down a little notch would be cool ..
thanks a lot for the help.
sincerly
kyle
Archived topic from Iceteks, old topic ID:2825, old post ID:23170
the password you dont remeber and i dont blame you and the mouse i copy and pasted that and it didnt work .. the BTN was sayin it wont work .. if theres anyway you can take it down a little notch would be cool ..
thanks a lot for the help.
sincerly
kyle
Archived topic from Iceteks, old topic ID:2825, old post ID:23170
Any kind of help with do
The BTN won't work? I think I might know why. All of the syntax in the MOUSEWHERE (x, y, btn) command ARE VARIABLES. I'm not sure if you did this or not. If you are still having problems, try this
VAR x : int
VAR y : int
VAR btn = 0
Where BTN is an Integer with an initial value of 0 (Button not pressed, if button pressed, it is given a value of 1).
Try that to see if it works. Oh, and just a heads up, you cannot compile a program with mousewhere in it. An error occurs due to the fact that turing's compilor is shoddy (good ol' dos related bs).
Watch out for the bugs in turing as well. I found a good chunk of them. If you want to know what they are, most of them are posted in the PROGRAMMING thread. Anyways, I'm still trying to think of the third problem with the ****'s. It's on the tip of my brain, but I'll need the actual program to test my thoughts. It's so hard to find a copy of the original turing. That's why God created E-Mule
Archived topic from Iceteks, old topic ID:2825, old post ID:23200
VAR x : int
VAR y : int
VAR btn = 0
Where BTN is an Integer with an initial value of 0 (Button not pressed, if button pressed, it is given a value of 1).
Try that to see if it works. Oh, and just a heads up, you cannot compile a program with mousewhere in it. An error occurs due to the fact that turing's compilor is shoddy (good ol' dos related bs).
Watch out for the bugs in turing as well. I found a good chunk of them. If you want to know what they are, most of them are posted in the PROGRAMMING thread. Anyways, I'm still trying to think of the third problem with the ****'s. It's on the tip of my brain, but I'll need the actual program to test my thoughts. It's so hard to find a copy of the original turing. That's why God created E-Mule
Archived topic from Iceteks, old topic ID:2825, old post ID:23200
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
ok thanks a lot .. maybe i should use C++ but i will just start to learn with turing since thats what my class is about...
also do you know where to download turing for free?
i want it on my home computer aswel so i have something to do and experiment with
Archived topic from Iceteks, old topic ID:2825, old post ID:23205
also do you know where to download turing for free?
i want it on my home computer aswel so i have something to do and experiment with
Archived topic from Iceteks, old topic ID:2825, old post ID:23205
Any kind of help with do
Ummm, I was able to find it on E-mule or Overnet (File sharing programs). The dos one of course. As for the Object Oriented one, you might find it in the same place (Hell, you're probably more likely to find that one). As for learning C++, it's best to learn turing first. Turing teaches you programming concepts and it is displayed in an easy interface. C++ is a little more difficult. Best to learn the concepts first .
Archived topic from Iceteks, old topic ID:2825, old post ID:23207
Archived topic from Iceteks, old topic ID:2825, old post ID:23207
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
ok so teach me ...
be my tutor .. that can make money ?
if i can get taught like simple steps i can send money through pay-pal ... no one around here knows programming so maybe you could be my tutor..
Archived topic from Iceteks, old topic ID:2825, old post ID:23208
be my tutor .. that can make money ?
if i can get taught like simple steps i can send money through pay-pal ... no one around here knows programming so maybe you could be my tutor..
Archived topic from Iceteks, old topic ID:2825, old post ID:23208
Any kind of help with do
Hmmmm, that sounds interesting. I'll have to think about it
Archived topic from Iceteks, old topic ID:2825, old post ID:23234
Archived topic from Iceteks, old topic ID:2825, old post ID:23234
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
I hope you can help.... not many people would ...
Archived topic from Iceteks, old topic ID:2825, old post ID:23254
Archived topic from Iceteks, old topic ID:2825, old post ID:23254
Any kind of help with do
I find Ruby is a great language to start with. It's simple, powerful, has industry support, and there's a lot of learning material available online. The environment is, of course, completely free.
http://www.ruby-lang.org
And a terrific book on it is available free online: http://www.poignant guide.net
Archived topic from Iceteks, old topic ID:2825, old post ID:23280
http://www.ruby-lang.org
And a terrific book on it is available free online: http://www.poignant guide.net
Archived topic from Iceteks, old topic ID:2825, old post ID:23280
Any kind of help with do
Sure I can help. I got nothing better to do . Just post up your problems and I'll help as best I can. I won't code full programs and give full solutions in case of culminating tasks and such where the teacher wants YOU to think the logics. But other than that, fire away with the questions. I'll try to reply as soon as possible (It'll take me longer to reply if posted on a weekend)
Archived topic from Iceteks, old topic ID:2825, old post ID:23299
Archived topic from Iceteks, old topic ID:2825, old post ID:23299
Any kind of help with do
And don't private message. There may be more than one person who can help.Furball wrote: Sure I can help. I got nothing better to do . Just post up your problems and I'll help as best I can. I won't code full programs and give full solutions in case of culminating tasks and such where the teacher wants YOU to think the logics. But other than that, fire away with the questions. I'll try to reply as soon as possible (It'll take me longer to reply if posted on a weekend)
Archived topic from Iceteks, old topic ID:2825, old post ID:23303
Any kind of help with do
True, very true. There are other people who know turing. If they're willing to help too, that's perfect.
Archived topic from Iceteks, old topic ID:2825, old post ID:23320
Archived topic from Iceteks, old topic ID:2825, old post ID:23320
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
ok this is all of turing i know so far....
i know how to type in words like put "~~~~~~"
also i know how to calculate numbers
i just learned how to use variables .. like var x:int or var x:real
can you teach me more steps?
just starting the easiest from that..
Archived topic from Iceteks, old topic ID:2825, old post ID:23327
i know how to type in words like put "~~~~~~"
also i know how to calculate numbers
i just learned how to use variables .. like var x:int or var x:real
can you teach me more steps?
just starting the easiest from that..
Archived topic from Iceteks, old topic ID:2825, old post ID:23327
Any kind of help with do
Do you know how to use functions and procedures?koopmicter wrote: ok this is all of turing i know so far....
i know how to type in words like put "~~~~~~"
also i know how to calculate numbers
i just learned how to use variables .. like var x:int or var x:real
can you teach me more steps?
just starting the easiest from that..
Functions and procedures provide "black boxes". You give certain bits of data to the function or procedure, and something happens. The key is that when you actually use the function or procedure, you don't care how it gets things done, just that it does.
Let's consider a simple pocedure which prints "Hello, world!":
Code: Select all
procedure sayHelloWorld
put "Hello, world!"
end sayHelloWorld[code]
Now, we can "call" this procedure by simply saying:
[code]sayHelloWorld[code]
But... what if we want to say hello to anyone?
We need to give the procedure an "argument", a piece of data we can use to customize what the procedure does.
[code]procedure sayHello (recipient : string)
put "Hello, " + recipient + "!"
end sayHello[code]
Then, when we want to greet someone:
[code]sayHello ("world")[code]
We can also use functions. A function returns a value back to the program, but it shouldn't output or change any variables that aren't declared inside it.
[code]function greeting (recipient : string)
result "Hello, " + recipient + "!"
end greeting[code]
And to use the function:
[code]put greeting ("world")[code]
Procedures can modify their arguments. Consider a procedure which takes two integers and adds the second to the first:
[code]procedure addUp (var first : int, second : int)
first := first + second
end addUp[code]
Of course, that one line can be made a bit more concise:
[code]procedure addUp (var first : int, second : int)
first += second
end addUp[code]
And then, when we call the procedure:
[code]var a, b : int := 1
addUp (a, b)
put a[code]
We'll see "2", because the addUp procedure modified "a".
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:2825, old post ID:23331[/size][/color]
Any kind of help with do
Do you know IF statements? If statements are the fundamentals of programming and in my opinion, the most important structures in programming. They go a little something like this:
Code: Select all
IF X >= Y THEN
%CONDITION 1
ELSIF X < Y THEN
%CONDITION 2
ELSE
%CONDITION 3
END IF
[code]
Now this might seem like arabic at first, but it's really quite simple. The first like states
IF X >= Y THEN
X and Y are variables. The >= is a comparison operator. WHAT DOES THAT MEAN? It means that the value of X is being compared to the value of Y. Now, let's just say, the value of X is 5 and the value of Y is 3. Now the >= part stands for GREATER THAN OR EQUAL. Hopefully you know the comparison operands (They throw this junk at you in math class, hope you weren't sleeping). But if you were, here is a list of comparison operands :blink:
> GREATER THAN
< LESS THAN
= EQUAL TO (The same as)
>= GREATER THAN OR EQUAL TO
<= LESS THAN OR EQUAL TO
NOT= NOT EQUAL TO
Phew, hopefully I explained that well enough :P. Anyways, the SYNTAX (form) of conditional statements always goes as followed:
The first value is ALWAYS compared to the SECOND value. So X is compared to Y, Not Y compared to X in the example:
[code] IF X >= Y THEN [code]
So the value of X is being compared to Y. So let's look at it like this. If X = 5 and Y = 3 then
[code] IF 5 >= 3 THEN [code]
There, now that looks a little easier to understand. What this code is saying is IF 5 IS GREATER THAN OR EQUAL TO 3, THEN DO SOMETHING....
The THEN part tells the computer: "I want you to do THIS if 5 is greater than or equal to 3". Underneath the THEN part, you put something that the computer will do if the condition is true. In the case 5 >= 3, it would be true because 5 is ALWAYS bigger than 3 (Or so we hope :P). So under the THEN part, you can put ANYTHING you want the computer to do, if the result is true. It could be a calculation, you can draw a box, you can have somebody picking their nose, ANYTHING. So, to show you what a BASIC condition statement looks like:
[code]
IF X >= Y THEN
%INSERT SOMETHING HERE, JUST FOR THE SAKE
%OF CLARITY, I'LL JUST SAY:
PUT "HELLO"
END IF
[code]
It's as simple as that. Mind you, conditional statementsc can go REALLY in depth, but we won't worry about that yet :P. Now, for conditional statments, there are three different lines of syntax (coding) that can be used:
[code]
IF
ELSIF
ELSE
[code]
Okay, so those are the three parts. EVERY conditional statement MUST HAVE an IF part to it. ELSIF is another condition WITHIN the same conditional statement. So, you can have more than ONE condition: This example shows you what I mean:
[code]
IF X > Y THEN
%CONDITION 1
ELSIF X = Y THEN
% CONDITION 2
ELSIF X < Y THEN
%CONDITION 3
END IF
[code]
So, in the above example, you have three conditions. I X is BIGGER THAN Y, you get one condition. If X is the same as Y you get another condition. If X is LESS than Y, you get another condition. This is how you can break up conditions, so if you don't know what the value of X and Y are going to be, this wiil allow for many different combinations.
Now the LAST part of conditional statements is ELSE. This is probably the easiest part of the conditional statement because you DON'T need any comparisons, It's just ELSE. And what does ELSE do? If NONE of the conditions ARE MET, such as if X isn't greater than Y, or Equal to Y, then the computer JUMPS to the else part:
[code]
If X > Y THEN
%COND 1
ELSIF x < Y THEN
%COND 2
ELSE
%COND 3
END IF
[code]
So, in the above example, let's say that X and Y were both 5. Now, the first part, X is not bigger than Y and X is not smaller than Y. So, in this case, the condition goes into the ELSE part. It's as simple as that. Hopefully I've explained conditional statements well enough. Hope this helps :)
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:2825, old post ID:23333[/size][/color]
Any kind of help with do
Hmmm, might help if you knew types:
TYPES OF VARIABLES:
INT = INTEGER. ANY WHOLE NUMBER SUCH AS 9, 235, -45, -9
REAL = ANY NUMBER: 0.46, 9.345, -42.54, 9, 3, 0 (Yes, Integers can be REAL numbers)
STRING = Any TEXT (CHAR). Example: "A, HERSD, PEOPLE, AKE, G$H%, 744HD84"
BOOLEAN = TRUE OR FALSE
You probably know the first THREE variable types so I'll just explain the last one:
Boolean is used in CONDITIONAL statements. Think of boolean as a switch. A switch has an ON button and an OFF button. It can't be BOTH, it can either be ONE or the other. Boolean is set like this
Var example : boolean := true
Var example : boolean := false
So, either true or false.
Boolean is used in conditional statements. You just SET a variable to be true or false, then when a certain condition is met, you can have the value change to true or false. In doing this, it will affect different things in the program. Think of it like a chain reaction. You know those rows of lights in the classroom? You know how the light switch usually has around 4 switches? You can turn SOME lights off, and keep SOME lights on. There are numerous possibilities: "All lights on, all lights off, first two lights on, middle lights on, etc". That's kind of how boolean works. Boolean is either true or false (on or off) and in doing this, you can change different things in your program. For example:
Var X := FALSE
LOOP
IF X = FALSE THEN
X := TRUE
PUT "HELLO"
ELSIF X = TRUE THEN
X:= FALSE
PUT "GOODBYE"
END IF
END LOOP
This is just showing (In a loop that goes on forever, so it just keeps repeating and repeating and repeating.) Anyways this just shows how the boolean value keeps changing. X Starts off as being FALSE, then it is compared in the conditional statement, and it's value is then changed to TRUE and the word "HELLO" is displayed. Now, the program restarts, and X is now TRUE, so instead of going in the FALSE section, it goes into the TRUE section where it's value is switched to FALSE and "GOODBYE" is displayed. So, this keeps going on forever and forever., the values are compared, and switched. It's kind of like some bored kid who just keeps flicking the light switch ON and OFF and ON and OFF.
Archived topic from Iceteks, old topic ID:2825, old post ID:23335
TYPES OF VARIABLES:
INT = INTEGER. ANY WHOLE NUMBER SUCH AS 9, 235, -45, -9
REAL = ANY NUMBER: 0.46, 9.345, -42.54, 9, 3, 0 (Yes, Integers can be REAL numbers)
STRING = Any TEXT (CHAR). Example: "A, HERSD, PEOPLE, AKE, G$H%, 744HD84"
BOOLEAN = TRUE OR FALSE
You probably know the first THREE variable types so I'll just explain the last one:
Boolean is used in CONDITIONAL statements. Think of boolean as a switch. A switch has an ON button and an OFF button. It can't be BOTH, it can either be ONE or the other. Boolean is set like this
Var example : boolean := true
Var example : boolean := false
So, either true or false.
Boolean is used in conditional statements. You just SET a variable to be true or false, then when a certain condition is met, you can have the value change to true or false. In doing this, it will affect different things in the program. Think of it like a chain reaction. You know those rows of lights in the classroom? You know how the light switch usually has around 4 switches? You can turn SOME lights off, and keep SOME lights on. There are numerous possibilities: "All lights on, all lights off, first two lights on, middle lights on, etc". That's kind of how boolean works. Boolean is either true or false (on or off) and in doing this, you can change different things in your program. For example:
Var X := FALSE
LOOP
IF X = FALSE THEN
X := TRUE
PUT "HELLO"
ELSIF X = TRUE THEN
X:= FALSE
PUT "GOODBYE"
END IF
END LOOP
This is just showing (In a loop that goes on forever, so it just keeps repeating and repeating and repeating.) Anyways this just shows how the boolean value keeps changing. X Starts off as being FALSE, then it is compared in the conditional statement, and it's value is then changed to TRUE and the word "HELLO" is displayed. Now, the program restarts, and X is now TRUE, so instead of going in the FALSE section, it goes into the TRUE section where it's value is switched to FALSE and "GOODBYE" is displayed. So, this keeps going on forever and forever., the values are compared, and switched. It's kind of like some bored kid who just keeps flicking the light switch ON and OFF and ON and OFF.
Archived topic from Iceteks, old topic ID:2825, old post ID:23335
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
this is sorta going way far ahead of me i just learnt today about string variables please dont go to far ahead (just dont wana get to confussed maybe start a little easyier) thanks
Archived topic from Iceteks, old topic ID:2825, old post ID:23370
Archived topic from Iceteks, old topic ID:2825, old post ID:23370
Any kind of help with do
It can look overwhelming. It really isn't, though. Just take things slowly.
Go through each example posted and try each one to make sure you understand that though it seems incredible at times, it works.
Archived topic from Iceteks, old topic ID:2825, old post ID:23397
Go through each example posted and try each one to make sure you understand that though it seems incredible at times, it works.
Archived topic from Iceteks, old topic ID:2825, old post ID:23397
Any kind of help with do
Alright. We'll discuss variables then. Now, there are two types:
VARIABLES AND CONSTANTS
Variables are shown like this:
VAR NAMEOFVARIABLE : TYPE
The var part you must have and then you put the name of the variable (can be anything, just don't start with numbers or weird characters). Then it is followed by a colon and the variable type:
INT: Integers. Any whole number -1, 34, 3343, -1234, 0
REAL: Any number: -1, 4.563, 932, 0.9465, -43.53
STRING: Characters like "A, BEGD, HELLO, HE#@8745"
BOOLEAN: True or False.
(Note: this is also explained in the boolean section I talked about before)
If you want the variable to have a value assigned to it, you can do that from the same line by saying:
VAR X : INT := 9
I chose X as my variable, it is an Integer and it has the value of 9. Therefore, X = 9.
If you want a variable to have a value, just write := (colon equals) and type in the value after it.
Now CONSTANTS are like variables. However, constants CANNOT change. The value given to a constant will always be the same. Constants are usually used in formulas (like the value of pi
CONST PI := 3.141592654
So instead of writing 3.14159... everytime, you can just say PI
So, you can use variables and contants just like you do numbers. You can add then together, subtract them, divide them, multiply them (if they are integers or real numbers).
So, let's say X = 9 and Y = 1
You can say this
PUT "VALUE OF X + Y is: ", x + y
So in that case, it will say "VALUE OF X + Y is 10" (Because of the values)
And in doing that, you can do any type of mathematics just by using the right operand (math symbol):
+ ADD
- SUBTRACT
* MULTIPLY (asterisk or SHIFT + 8)
/ DIVIDE (SHIFT + ?)
** SQUARE (Will square the value of your variable or constant)
A few examples (let x = 9 and y = 3)
CODE
X + Y WOULD EQUAL 12
X - Y WOULD EQUAL 6
X * Y WOULD EQUAL 27
X / Y WOULD EQUAL 3
X ** Y WOULD EQUAL 729
Now, as with numbers, variable values follow the BEDMAS rules. Every math part, goes in order.
B=Brackets/parenthesis
E=Exponents
D=Division
M=Multiplication
A=Addition
S=Subtraction
So, if you say this:
(X + Y) / 4
The computer will add X and Y first because of the brackets. Then, it will take that value and divide it by 4. So X + Y (If we keep the values the same, x = 9 and y = 3) it would look like this:
(9 + 3) / 4
So that's 12/4 which is 3, so that would be the answer
Now, with variables, it is important to know how to store values into them. You can take any variable (I'll make one called Z just as an example. We'll say Z = 0 for now). NOTE: It is always a good programming practice to set a variable with a default value (a value that it starts with). That way, if it is used in a formula or someplace else, it will not stop the execution of your program because it doesn't have a value. .
So, if you want to store a value into a variable, you just need to do this
VAR X: INT:=9
VAR Y: INT:=3
VAR Z: INT:= 0
Z:= X + Y
Now, you see what I did? Z will be the value of X and Y added together (12). Whatever Z's value was before, forget about it, as soon as you make a statement like that, Z's value is gone, and it gains a new value (in this case, 12). Say you wanted something to add to the value of Z, you would need to do something like this
Z:= Z + 9
So, if we look at it like this, the value of Z will get 9 more added to it (20 because of 12+9).
Well, that's probably the basics of variables. If you have anymore questions, let us know .
Archived topic from Iceteks, old topic ID:2825, old post ID:23398
VARIABLES AND CONSTANTS
Variables are shown like this:
VAR NAMEOFVARIABLE : TYPE
The var part you must have and then you put the name of the variable (can be anything, just don't start with numbers or weird characters). Then it is followed by a colon and the variable type:
INT: Integers. Any whole number -1, 34, 3343, -1234, 0
REAL: Any number: -1, 4.563, 932, 0.9465, -43.53
STRING: Characters like "A, BEGD, HELLO, HE#@8745"
BOOLEAN: True or False.
(Note: this is also explained in the boolean section I talked about before)
If you want the variable to have a value assigned to it, you can do that from the same line by saying:
VAR X : INT := 9
I chose X as my variable, it is an Integer and it has the value of 9. Therefore, X = 9.
If you want a variable to have a value, just write := (colon equals) and type in the value after it.
Now CONSTANTS are like variables. However, constants CANNOT change. The value given to a constant will always be the same. Constants are usually used in formulas (like the value of pi
CONST PI := 3.141592654
So instead of writing 3.14159... everytime, you can just say PI
So, you can use variables and contants just like you do numbers. You can add then together, subtract them, divide them, multiply them (if they are integers or real numbers).
So, let's say X = 9 and Y = 1
You can say this
PUT "VALUE OF X + Y is: ", x + y
So in that case, it will say "VALUE OF X + Y is 10" (Because of the values)
And in doing that, you can do any type of mathematics just by using the right operand (math symbol):
+ ADD
- SUBTRACT
* MULTIPLY (asterisk or SHIFT + 8)
/ DIVIDE (SHIFT + ?)
** SQUARE (Will square the value of your variable or constant)
A few examples (let x = 9 and y = 3)
CODE
X + Y WOULD EQUAL 12
X - Y WOULD EQUAL 6
X * Y WOULD EQUAL 27
X / Y WOULD EQUAL 3
X ** Y WOULD EQUAL 729
Now, as with numbers, variable values follow the BEDMAS rules. Every math part, goes in order.
B=Brackets/parenthesis
E=Exponents
D=Division
M=Multiplication
A=Addition
S=Subtraction
So, if you say this:
(X + Y) / 4
The computer will add X and Y first because of the brackets. Then, it will take that value and divide it by 4. So X + Y (If we keep the values the same, x = 9 and y = 3) it would look like this:
(9 + 3) / 4
So that's 12/4 which is 3, so that would be the answer
Now, with variables, it is important to know how to store values into them. You can take any variable (I'll make one called Z just as an example. We'll say Z = 0 for now). NOTE: It is always a good programming practice to set a variable with a default value (a value that it starts with). That way, if it is used in a formula or someplace else, it will not stop the execution of your program because it doesn't have a value. .
So, if you want to store a value into a variable, you just need to do this
VAR X: INT:=9
VAR Y: INT:=3
VAR Z: INT:= 0
Z:= X + Y
Now, you see what I did? Z will be the value of X and Y added together (12). Whatever Z's value was before, forget about it, as soon as you make a statement like that, Z's value is gone, and it gains a new value (in this case, 12). Say you wanted something to add to the value of Z, you would need to do something like this
Z:= Z + 9
So, if we look at it like this, the value of Z will get 9 more added to it (20 because of 12+9).
Well, that's probably the basics of variables. If you have anymore questions, let us know .
Archived topic from Iceteks, old topic ID:2825, old post ID:23398
Any kind of help with do
Hello - I have a question about Turing. I don't know if it's been covered here already, but I was wondering how to import graphics into Turing. I have a BMP file from Paint that I would like to have show up in the Turing program, and I'm not sure how to get it in there.
Thanks in advance.
Archived topic from Iceteks, old topic ID:2825, old post ID:23476
Thanks in advance.
Archived topic from Iceteks, old topic ID:2825, old post ID:23476
-
- Posts: 13
- Joined: Tue Nov 09, 2004 11:15 am
Any kind of help with do
ok fur i understand most of the var talk this is what i understand so far..
var (NAME OF VERB):(VERB TYPE)
now name of verb can be what ever you want it to be from aushduisd to dogs.
the verb type is either:
string
int
real
we dont use boolean in grade 10 so i dont need to learn that even though i know its a true/false
also i know how to make a variable mean something sorta like this...
var money:int
var count:real
var overall:real
money:=12
count:=12.5
overall:=money+count
put "Overall the question equals"," ",overall
PLUS
i know get statements like
var goods:string
put "Hello what is your name?"
get name
put "Hello Mr./Mrs."," ",name
that is about all i know for variables
Archived topic from Iceteks, old topic ID:2825, old post ID:23479
var (NAME OF VERB):(VERB TYPE)
now name of verb can be what ever you want it to be from aushduisd to dogs.
the verb type is either:
string
int
real
we dont use boolean in grade 10 so i dont need to learn that even though i know its a true/false
also i know how to make a variable mean something sorta like this...
var money:int
var count:real
var overall:real
money:=12
count:=12.5
overall:=money+count
put "Overall the question equals"," ",overall
PLUS
i know get statements like
var goods:string
put "Hello what is your name?"
get name
put "Hello Mr./Mrs."," ",name
that is about all i know for variables
Archived topic from Iceteks, old topic ID:2825, old post ID:23479
Any kind of help with do
You're pretty much on the right track, but think of variables as nouns, rather than verbs. Procedures are the equivalent to verbs, and functions are sort of verbs that have been made into nouns.koopmicter wrote: var (NAME OF VERB):(VERB TYPE)
"bob" is a noun
"greet" is a procedure
"greeting" is based on a verb word, but it can also be a noun, as in "his greeting was really nice"
Archived topic from Iceteks, old topic ID:2825, old post ID:23483