| Author |
Message |
Tony

|
Posted: Sun Jan 16, 2011 3:41 pm Post subject: Re: RE:Urgent Help for Calculator Program |
|
|
Tony @ Sun Jan 16, 2011 2:55 pm wrote: 3*10 + 5 = 35; % int |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Sponsor Sponsor

|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 4:10 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
how would i put that though,
if button = 1 and num =3 and num = 5 then
num := 3*10+5
end if
something like that?
plz man i just need help on this final project and i will never come here again. i'll even give you all my bits |
|
|
|
|
 |
Tony

|
Posted: Sun Jan 16, 2011 4:24 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
Look, nobody is going to just give you a complete solution. A working program is just a proxy for checking if you have some basic comprehension of the material, but
Quote:
if ... num =3 and num = 5 ...
shows that this might not be the case.
Go back and re-read all of the replies, there's a lot of good material in there for you to use. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 5:14 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| okay, i read it. i am using ints for my numbers. say if used intstr to display a number and then convert it back to strint, will that number be any number or the original number |
|
|
|
|
 |
Tony

|
Posted: Sun Jan 16, 2011 5:18 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
try it out
| code: |
var num:int := 42
put strint(intstr(num))
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 7:10 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| it doesnt work |
|
|
|
|
 |
TokenHerbz

|
Posted: Sun Jan 16, 2011 7:33 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| yes it does, Infact add +8 to the end of the 2nd line, it outputs 50... |
|
|
|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 9:17 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| no i get what you are trying to say, but when i put it into my code, i put it into the loop, it said i have too few parameters |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Tony

|
|
|
|
 |
Wajih
|
Posted: Sun Jan 16, 2011 10:59 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| ok i did. i made num into num3 because num has already been declared. but how is that number supposed to help me do double digit operations becuase its value doesnt change, it will always be 42. are you implying that i have to create 999 variables and put them into strint? like create them by arraying them? |
|
|
|
|
 |
Tony

|
Posted: Sun Jan 16, 2011 11:19 pm Post subject: Re: RE:Urgent Help for Calculator Program |
|
|
Because you've asked...
Wajih @ Sun Jan 16, 2011 5:14 pm wrote: if used intstr to display a number and then convert it back to strint, will that number be any number or the original number |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
TokenHerbz

|
Posted: Mon Jan 17, 2011 2:42 am Post subject: RE:Urgent Help for Calculator Program |
|
|
| Turing: |
var number1 : int %%INT VARIABLES
var number2 : int
var answer : int
%%Number 1 = 5 + 0 for 50 (because we add them ass strings, convert to number after
number1 := strint (intstr (5) + intstr (0))
%%like num = string to int ( int to string (number 1) + ( int to string (other numbers) )
number2 := strint (intstr (1) + intstr (0))
answer := number1 + number2 %%we can add these numbers
put answer %%%out put is 60. not 5+0+1+0 = 6. we make it like
%%num 1 = "String 5 + 0" = string 50 -> convert to int.
%%num 2 = "string 1 + 0" = string 10 -> conver to int
%%answer = int 50 + int 10 = 60.... get it???
|
|
|
|
|
|
 |
Wajih
|
Posted: Mon Jan 17, 2011 1:19 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| yeye i get it but is the value of the answer 60 now? |
|
|
|
|
 |
Tony

|
Posted: Mon Jan 17, 2011 1:23 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
| You should be able to answer that. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
TokenHerbz

|
Posted: Mon Jan 17, 2011 3:15 pm Post subject: RE:Urgent Help for Calculator Program |
|
|
You should get into the habbit of testing these things out yourself. If you cant understand it by reading the code, add a few test lines to make sure it really is INT value of 60...
| Turing: |
put answer - 30 %%outputs 30
put answer - 60 %%outputs 0 (proof value is 60)
put answer + "TEST" %%will error cause its INT value.
|
Pretty Basic stuff... |
|
|
|
|
 |
|