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

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




PostPosted: Sun Jun 04, 2006 3:45 pm   Post subject: Help with strings

This is a program that I'm making for school. This will connect to a parallel port eventually. I do not need any help with that. I am looking for help with my strings. I would like it to be able to take in more than one number and display them with a delay. I would also like for it to be able to display letters. If any of you could help it would be greatly appreciated.

Here is my code.

code:

%sets the screen to graphics mode
setscreen ("graphics:vga")

%draws a grid for easier placement to start
for h : 0 .. maxx by 10
    for i : 0 .. maxy by 10
        drawdot (h, i, white)
    end for
end for

%draws the "box"
drawfillbox (390, 380, 570, 80, 255)
%top
drawfilloval (480, 350, 60, 10, 4)
%top left
drawfilloval (420, 290, 10, 60, 4)
%top right
drawfilloval (540, 290, 10, 60, 4)
%middle
drawfilloval (480, 230, 60, 10, 4)
%bottom left
drawfilloval (420, 170, 10, 60, 4)
%bottom
drawfilloval (480, 110, 60, 10, 4)
%bottom right
drawfilloval (540, 170, 10, 60, 4)

%box to end
locatexy (25, 32)
put "end"
drawbox (10, 10, 60, 60, 255)

var ch : string (1)
var c : int
var x, y, button : int
locate (1, 1)
put "Press any numerical key"
loop
    mousewhere (x, y, button)
    if hasch then
        getch (ch)
        if strintok (ch) then
            c := strint (ch)
            locatexy (370, 70)
            put "The character entered is a: ", ch

            %number box display

            if c = 1
                    then
                %top
                drawfilloval (480, 350, 60, 10, 7)
                %top left
                drawfilloval (420, 290, 10, 60, 7)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 7)
                %bottom left
                drawfilloval (420, 170, 10, 60, 7)
                %bottom
                drawfilloval (480, 110, 60, 10, 7)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 2
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 7)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 4)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 7)

            elsif c = 3
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 7)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 7)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 4
                    then
                %top
                drawfilloval (480, 350, 60, 10, 7)
                %top left
                drawfilloval (420, 290, 10, 60, 4)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 7)
                %bottom
                drawfilloval (480, 110, 60, 10, 7)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 5
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 4)
                %top right
                drawfilloval (540, 290, 10, 60, 7)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 7)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 6
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 4)
                %top right
                drawfilloval (540, 290, 10, 60, 7)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 4)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 7
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 7)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 7)
                %bottom left
                drawfilloval (420, 170, 10, 60, 7)
                %bottom
                drawfilloval (480, 110, 60, 10, 7)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 8
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 4)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 4)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 9
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 4)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 4)
                %bottom left
                drawfilloval (420, 170, 10, 60, 7)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            elsif c = 0
                    then
                %top
                drawfilloval (480, 350, 60, 10, 4)
                %top left
                drawfilloval (420, 290, 10, 60, 4)
                %top right
                drawfilloval (540, 290, 10, 60, 4)
                %middle
                drawfilloval (480, 230, 60, 10, 7)
                %bottom left
                drawfilloval (420, 170, 10, 60, 4)
                %bottom
                drawfilloval (480, 110, 60, 10, 4)
                %bottom right
                drawfilloval (540, 170, 10, 60, 4)

            end if
        end if
    end if
    exit when 10 < x and x < 60 and 10 < y and y < 60 and button = 1
end loop
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: