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

Username:   Password: 
 RegisterRegister   
 Calculating with a draw text
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
WooFerPPK




PostPosted: Fri Nov 22, 2002 12:24 am   Post subject: Calculating with a draw text

im stuck, and i cant fiqure out any way to do this here is my program.
Im going to give u my hole program because i might have done somthing worng during it, and plus u need to input numbers. The problem is text := money text is a string and money is an interger, i want to get text to output the calculation of money but wont let me because they are differnt. please help

code:
View.Set ("graphics:786;540,nobuttonbar")
var book, money, late : int
var zero : real
var font1 : int
var fontselect, text : string


fontselect := "Times New Roman:17"
font1 := Font.New (fontselect)
text := "How many books did you take out?"
drawfilloval (maxx div 2, maxy div 2, 175, 60, yellow)
Draw.Text (text, maxx div 2 - 160, maxy div 2, font1, 12)

drawfilloval (maxx div 2, maxy div 2 - 40, 70, 20, red)
locate (27 div 2 + 7, 80 div 2 + 2)
color (white)
colorback (red)
get book

text := "How many days late?"
drawfilloval (maxx div 2, maxy div 2, 173, 60, yellow)
Draw.Text (text, maxx div 2 - 120, maxy div 2, font1, 12)
Font.Free (font1)

drawfilloval (maxx div 2, maxy div 2 - 40, 70, 20, red)
locate (27 div 2 + 7, 80 div 2 + 2)
color (white)
colorback (red)
get late

for decreasing ypos : 195 .. 120 by 5
    drawfilloval (maxx div 2, ypos, 20, 20, 12)
    delay (40)
end for

for decreasing xpos : 390 .. 200 by 5
    drawfilloval (xpos, 120, 20, 20, 12)
    delay (40)
end for

money := book * late

delay (100)
for size : 1 .. money div 10 * 4
    drawfilloval (200, 120, size, size, 9)
    delay (10)
end for


text := money

code:
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Nov 22, 2002 3:09 am   Post subject: (No subject)

here's what you're looking for:

intstr()
and
strint()

both functions convert integer to string and vice wersa. I think that you're looking for STRINT().

so it should be

code:
text:= strint(money)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
WooFerPPK




PostPosted: Fri Nov 22, 2002 3:27 am   Post subject: (No subject)

thanks a million
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 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: