Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Calculator Questions
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2, 3, 4
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Wajih




PostPosted: Sat Jan 15, 2011 10:05 pm   Post subject: RE:Calculator Questions

i did that but when i tried to press any second set of buttons, they would not work, any reasons why?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Jan 15, 2011 10:14 pm   Post subject: RE:Calculator Questions

Perhaps the code flow is not where you expect it to be, or the values of mouse variables don't line up with the expected if conditionals. Trace through your program, and try to figure out exactly what's going on at every step of it.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Wajih




PostPosted: Sat Jan 15, 2011 10:27 pm   Post subject: RE:Calculator Questions

but when i put it all in one loop, both sets of numbers work, why is that?

and do you know how to shorten string catenation generated by a string
Tony




PostPosted: Sat Jan 15, 2011 10:56 pm   Post subject: Re: RE:Calculator Questions

Wajih @ Sat Jan 15, 2011 10:27 pm wrote:
but when i put it all in one loop, both sets of numbers work, why is that?

When you randomly put things in and out of code, there's a discrepancy between what you are telling the computer to do and what you understand about the things that you tell the computer to do. The difference between the two is the cause for a majority of problems with running programs.

Wajih @ Sat Jan 15, 2011 10:27 pm wrote:

and do you know how to shorten string catenation generated by a string

I don't understand this question.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Wajih




PostPosted: Sat Jan 15, 2011 11:09 pm   Post subject: RE:Calculator Questions

but i am doing the same thing that you told me.

i put

loop
view update
draw stuff
loop
viewupdate
drawstuff
num
end loop
loop
viewupdate
drawstuff
num2
end loop
end loop

i did that. it recognized the first number and the operator, but it did not recognize the second number.

also, is there a command similar to locate?
Tony




PostPosted: Sat Jan 15, 2011 11:49 pm   Post subject: RE:Calculator Questions

I also said to read the documentation on View.Update (and the example provided there). Things you draw will not show up on screen until View.Update is called (think about the order of drawing stuff, and telling it to show up).

Also, unless there's a lot of "flashing" happening, you don't really need offscreenonly mode.

Documentation for locate might list related functions. Is there something in particular you are looking for?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Wajih




PostPosted: Sun Jan 16, 2011 12:07 am   Post subject: RE:Calculator Questions

exactly bro, i read it. i out the view update at the bottom of the loops AFTER it did all the drawing stuff, but then the whole screen went blank and i couldnt do anything with it.

and there is a lot of flashing going on which is why i am using offscreenonly

yes, there is.

i made up a button and a variable.

once something is multiplied, or divided, or added, or subtracted

i store it in a variable. then i "locate"
that variable onto a certain row and column.

there is a button that when it is pressed, it is supposed to clear what i have typed and set the answer back to 0.

but if try pressing that button , only the numbers that i did the operations with get deleted, not the answer. is there anything related that will cls of the answer and set the answer back to 0?
Tony




PostPosted: Sun Jan 16, 2011 12:17 am   Post subject: RE:Calculator Questions

if you use something like
code:

locate(row, column)
put ""

That will clear (draw on top of) the entire row.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Wajih




PostPosted: Sun Jan 16, 2011 1:16 pm   Post subject: RE:Calculator Questions

i got that too work but i still do not know how to do double digit operations.
Tony




PostPosted: Sun Jan 16, 2011 1:37 pm   Post subject: RE:Calculator Questions

Maybe ask huskiesgoaler34? http://compsci.ca/v3/viewtopic.php?t=27249
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 4 of 4  [ 55 Posts ]
Goto page Previous  1, 2, 3, 4
Jump to:   


Style:  
Search: