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

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




PostPosted: Tue Oct 21, 2003 10:48 am   Post subject: Help with text

Can i make text with a line going straight through it, to make the text look like its been crosed out? If so, whats the code? I have to make a Yahtzee game for comp sci and thought this would add a nice affect.
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Tue Oct 21, 2003 12:27 pm   Post subject: (No subject)

well there is no text coamnd for that, but you could use the graifcks comands like Draw.Line to draw a line thougth it after you print it on the screen
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony




PostPosted: Tue Oct 21, 2003 3:26 pm   Post subject: (No subject)

if you're using Font.Draw, you can draw another string of
code:

put repeat("-", length(word))


using same coordinates. It should cross it out.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hackman




PostPosted: Mon Oct 27, 2003 11:03 am   Post subject: (No subject)

Sorey i took so long to reply. Looks like im gona have to just use drawline.
Tony's idea dosent seem to work on my schools version of turing. Thanks for the replies.
Tony




PostPosted: Mon Oct 27, 2003 6:10 pm   Post subject: (No subject)

repeat is a function and returns a value, not a procedure. You'd have to ether assign value to a variable first or use something like put that assepts a value. I modified the code above.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hackman




PostPosted: Tue Oct 28, 2003 11:52 am   Post subject: (No subject)

I still get an 'Expression cannot contain subscripts' error.
thoughtful




PostPosted: Tue Oct 28, 2003 5:30 pm   Post subject: example

Here is an example of wht tony means Arrow
code:

var font : int := Font.New ("verdana:12")
var word : string
var strikeout : string
var x, y := 50
put "Type in the word to be striked out"
get word : *
cls
Font.Draw (word, x, y, font, black)
strikeout := repeat ("-", length (word) + length (word) div 3)
Font.Draw (strikeout, x, y, font, black)
thoughtful




PostPosted: Tue Oct 28, 2003 5:36 pm   Post subject: Mine

I made this program which can strikeout almost ne fontsize and look pretty good

code:

const fontsize:=40
var font : int := Font.New ("verdana:"+intstr(fontsize))
var word : string
var strikeout : string
var x, y := 50
put "Type in the word to be striked out"
get word : *
cls
Font.Draw (word, x, y, font, black)
strikeout := repeat ("_", length (word)-length(word) div 10)
Font.Draw (strikeout, x, y+(fontsize div 2), font, black)

Change the fountsize:= value to change the font size
Sponsor
Sponsor
Sponsor
sponsor
hackman




PostPosted: Wed Oct 29, 2003 10:54 am   Post subject: (No subject)

Ok, now i get it. Thanks.
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  [ 9 Posts ]
Jump to:   


Style:  
Search: