| wtd - Nov-30-2004 server time | ||
Ermmm... it's pretty simple.
|
| typon - Nov-30-2004 server time |
| yeah wtd thats wat ur supposed to do.. use a loop but how do i put the loop in an if command? |
| Furball - Nov-29-2004 server time |
| LOL. Ya, your teacher must be a moron. I don't think SHE even knows how to do it. Still, it can't be as bad as MY programming teacher. Pretty sad when the student knows more than the teacher. Anyways, my email is muitto101@hotmail.com.. Send it whenever and I'll be able to check out that MOD operand. Although I think that question was answered. |
| typon - Nov-28-2004 server time |
| haha thanks man I REALLY F***king HATE HER THoUGH ill try thanks man <3 P.S Furball pm me ur email ill send turing its only like 3 mb or smth. |
| wtd - Nov-27-2004 server time | ||||
Ok, your teacher is a frickin' moron. "mod" is an operator. It's an integral part of the language. And subtracting one from a number like you want looks like:
If your teacher says you can't use loops, hit him or her for me, ok? |
| Furball - Nov-27-2004 server time |
| Sure, why not? I should really start up my programming again (Now that I have time |
| typon - Nov-27-2004 server time | ||
do u want turing? cuz i really love u guys and ur help PS. HELP MEE ARGOIA#T*)Y#A*)%TH#Q)*%H)Q@*#%Q@#Y%G |
| Red Squirrel - Nov-27-2004 server time |
| It gets worse, we're doing visual basic and we're not allowed to use conditional statements. |
| typon - Nov-27-2004 server time |
| exactly wat i have been trying to do subract 1 from the var entered by the user until it reaches 0 or if its a real number i t will reach 0.xxxxxx but my teacher said i cant use mod i have to use operators i have been looking for a way to subtract 1 from the number x amount of times (x is the first number to the left of the decimal. THIS IS GETTING ON MY NEERVEEESSS |
| wtd - Nov-27-2004 server time | ||||
That should work. Most languages only let modulus work on integers (as it should be), but Turing let's it work on decimal numbers as well.
Yields:
|
| Furball - Nov-26-2004 server time |
| I know how to do that. You need to use a function called MODULUS. It's a built in function, called in an if statement. The coding is MOD. I hardly ever use MOD because I don't find it particularly useful. Although I don't remember the EXACT syntax, I'll be able to explain what it does. I believe that MOD takes a number and checks to see if it has remainders or not. If it does not have a remainder, MOD returns the value of 0 and if it DOES have a remainder, it returns the value of 1. You'll have to research about MOD in your turing manual (you do have one, riiiight?). But All I think you have to do is take the number, and MOD it to check if it has remainders or not. Obviously, if it has a remainder, it is a real number. Otherwise, if it has no remainders, it is an INT (Well, it's a real too, but that's beyond the point.). Anyways, if anyone else can remember what MOD does and how to use it, feel free to elaborate. I on the other hand, am out of brain juice and I don't have turing anymore to test my theories. EN JOY! |
| typon - Nov-25-2004 server time | ||
sorry man but you're getting really close and u understand wat i mean but as i stated in my last post. you can not use any built in functions. just implement what floor does by using boolean operators. plz help meeee THANKS JRT>< |
| wtd - Nov-25-2004 server time | ||||||
Well, in Turing, the program to get the number would look something like:
Or maybe:
In either case, you've already stated whether the variable is an integer or floating point number. What I suspect you mean, though, is, given that you declare the variable as a real, you want to know if someone just typed an integer anyway. This is easy to find out. The basic process is to get just the integer part of the number, and compare it to the original. If they're the same, then clearly there was nothing after the decimal point. The floor function will take a floating point number, and give you just the integer part.
|
| typon - Nov-24-2004 server time |
| sorry but that doesnt answer my question i am asking that i have to make a program where user puts a number THEN the computer will tell the user whether they put a real number or an integer. and the outlines i already stated in my last post.. someone plzz help me |
| Furball - Nov-23-2004 server time |
| Yes, turing has to have the type enforced. You can't just sneak away without telling the computer what TYPE of variable it is. The only way the computer can tell without you specifying the type is to assign it a value. For example, if you say VAR X := "hello" turing will automatically associate it as a string. However, it is a good practice to assign the TYPE to your variables. That way, you'll know what they are in the future. Oh, while I'm on this subject, might as well tell you about commenting. Commenting isn't really executable coding in a program (which means that it does not affect how the program is run), but it is extremely important. Here's an example of commenting %This is a comment The coding for comments requires a single % symbol, then anything after it. What does commenting do? Well, it simply puts lines of text in the program. It doesn't do anything special to your program or anything. HOWEVER, it can prove to be most useful. You use commenting to talk about parts of your program. For example, you come to a part of your program, and while programming, you comment to tell others what your program will do. I use commenting alot for variables. I comment my variables and explain what each variable will do and why it is used. When your programs start to get really big (EX: 4000 lines), you'll NEED commenting to know where things are going to go. Commenting is also useful for setting link points in your program. If you need to find something, give the comment a unique name such as %MAIN PROGRAM and just go into the turing menu, select FIND WORD and type that in. The result is the program will jump to that line of text and bring you where you go (Very useful, saves time in trying to find an area of code). Here's an example of commenting variables: %VARIABLE X: This variable is used in calculating the length of an object. It is given %the default value of 0 and is used in the area formula VAR X: INT:= 0 This just explains what X will do. You see, before you even see variable X being used, you have a rough idea of what it will do. The next one is using a comment as a link point: LOOP PUT "HELLO" END LOOP If h = true then end if %CALCULATIONS LOOP %coding %coding END LOOP %MAIN FOR I: 1..3 %Lines of code END FOR You see, I have 2 linking comments. One being called CALCULATIONS and one called MAIN. So, no matter where I am in the coding of my program, all I have to do is select the FIND WORD section and type in MAIN, then the program will jump to that area and bring me where I need to go. So that's basically commenting. Commenting is simple, yet affective, especially if you are working in a group project or you decide to take a break from programming something for a very long time. That way, when you or somebody forgets what the variable or the program does, you can easily find out. |
| wtd - Nov-23-2004 server time |
| Well, Turing enforces types, so a variable has to be declared as int or real. As a result, you'll always know. |
| typon - Nov-23-2004 server time |
| THanks for helping for the last one...i figured my way through so now im actually gunna continue getting help ok you have to use if commands and only + / - * . and NO turing built in functions to tell the user if the number entered by the user is a real number or integer. i know it sounds easy but i have NO idea how i can do this. plz help ill be reaaaallly grateful. EDIT: oh yes and i use the windows version OOT |