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:48 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
TheOneTrueGod




PostPosted: Sun Jun 04, 2006 9:22 pm   Post subject: (No subject)

I don't think theres really that much better of a way to do this really... You're just going to have to use drawn-out if clauses. You could try proceduralizing it, and passing parameters, for example:
code:

DrawThingy(v1,v2,v3,v4,v5,v6,v7 : int) %This is REALLY bad naming convention, but its late, and i'm exhausted.
%draws the "box"
drawfillbox (390, 380, 570, 80, 255)
%top
drawfilloval (480, 350, 60, 10, v1)
%top left
drawfilloval (420, 290, 10, 60, v2)
%top right
drawfilloval (540, 290, 10, 60, v3)
%middle
drawfilloval (480, 230, 60, 10, v4)
%bottom left
drawfilloval (420, 170, 10, 60, v5)
%bottom
drawfilloval (480, 110, 60, 10, v6)
%bottom right
drawfilloval (540, 170, 10, 60, v7)
end DrawThing

DrawThing(7,7,4,7,7 ,7,4)%Will draw the "1" shape.


Other than that, I really don't see what you're asking... You're just going to have to figure out how to make it look like an "a", how to make it look like a "b", etc...
5had0w




PostPosted: Sun Jun 04, 2006 9:30 pm   Post subject: (No subject)

The part that I'm asking is how I can get my string to let me put letters in an if statement after the get command. I don't know how to use letters in my if statements. I've tried switching it to just get from getch but I still couldn't get it working.

The other thing I'm asking is how I can type in a line of numbers eg. a phone number and have it display them one at a time with a delay in between.

Thanks for the help
TheOneTrueGod




PostPosted: Sun Jun 04, 2006 9:48 pm   Post subject: (No subject)

ok, thats a more specific question I can answer.

strings can be parsed just by using parenthesisYour welcome wtd Razz

code:

var s : string
s := "abcd1234"
put s(3..4)
put s(7)
put s(*)


same with the phone number..

code:

var s : string := "905-666-6666"
for i : 1..length*(s)
   %Pseudo Code
   if s(1) = "9" then
     ...
      drawn out if clause here (PLEASE use the procedure.  It'll make life SO much easier for ya)
   %etc
  end if
end for


and that hunk of barely legible code should show you what to do Razz
5had0w




PostPosted: Sun Jun 04, 2006 10:46 pm   Post subject: (No subject)

Okay so its getting late and I've modified my program with a lot of help.

This is my current program.

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)

procedure DrawThing (v1, v2, v3, v4, v5, v6, v7 : int)
    %top
    drawfilloval (480, 350, 60, 10, v1)
    %top left
    drawfilloval (420, 290, 10, 60, v2)
    %top right
    drawfilloval (540, 290, 10, 60, v3)
    %middle
    drawfilloval (480, 230, 60, 10, v4)
    %bottom left
    drawfilloval (420, 170, 10, 60, v5)
    %bottom
    drawfilloval (480, 110, 60, 10, v6)
    %bottom right
    drawfilloval (540, 170, 10, 60, v7)
end DrawThing

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

var ch : string
var c : int
var x, y, button : int

locate (1, 1)
put "Press any numerical key"
loop
    for i : 1 .. 255
        mousewhere (x, y, button)
        if hasch then
            get ch
            locatexy (350, 70)
            put "The character entered is a(n): ", ch
            locate (2, 1)
           
            %number box display

            if ch (1) = "1"
                    then
                DrawThing (7, 7, 4, 7, 7, 7, 4)
            elsif ch (1) = "2"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
            elsif ch (1) = "3"
                    then
                DrawThing (4, 7, 4, 4, 7, 4, 4)
            elsif ch (1) = "4"
                    then
                DrawThing (7, 4, 4, 4, 7, 7, 4)
            elsif ch (1) = "5"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
            elsif ch (1) = "6"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
            elsif ch (1) = "7"
                    then
                DrawThing (4, 7, 4, 7, 7, 7, 4)
            elsif ch (1) = "8"
                    then
                DrawThing (4, 4, 4, 4, 4, 4, 4)
            elsif ch (1) = "9"
                    then
                DrawThing (4, 4, 4, 4, 7, 4, 4)
            elsif ch (1) = "0"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
            elsif ch (1) = "a"
                    then
                DrawThing (4, 4, 4, 4, 4, 7, 4)
            elsif ch (1) = "b"
                    then
                DrawThing (4, 4, 4, 4, 4, 4, 4)
            elsif ch (1) = "c"
                    then
                DrawThing (4, 4, 7, 7, 4, 4, 7)
            elsif ch (1) = "d"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
            elsif ch (1) = "e"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 7)
            elsif ch (1) = "f"
                    then
                DrawThing (4, 4, 7, 4, 4, 7, 7)
            elsif ch (1) = "g"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
            elsif ch (1) = "h"
                    then
                DrawThing (7, 4, 4, 4, 4, 7, 4)
            elsif ch (1) = "i"
                    then
                DrawThing (7, 4, 7, 7, 4, 7, 7)
            elsif ch (1) = "j"
                    then
                DrawThing (7, 7, 4, 7, 4, 4, 4)
            elsif ch (1) = "k"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "l"
                    then
                DrawThing (7, 4, 7, 7, 4, 4, 7)
            elsif ch (1) = "m"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "n"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "o"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
            elsif ch (1) = "p"
                    then
                DrawThing (4, 4, 4, 4, 4, 7, 7)
            elsif ch (1) = "q"
                    then
                DrawThing (4, 4, 4, 4, 7, 7, 4)
            elsif ch (1) = "r"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "s"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
            elsif ch (1) = "t"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "u"
                    then
                DrawThing (7, 4, 4, 7, 4, 4, 4)
            elsif ch (1) = "v"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "w"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "x"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "y"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
            elsif ch (1) = "z"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
            elsif ch (1) = "-"
                    then
                DrawThing (7, 7, 7, 4, 7, 7, 7)
delay (100)

            if ch (2) = "1"
                    then
                DrawThing (7, 7, 4, 7, 7, 7, 4)
            elsif ch (2) = "2"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
            elsif ch (2) = "3"
                    then
                DrawThing (4, 7, 4, 4, 7, 4, 4)
            elsif ch (2) = "4"
                    then
                DrawThing (7, 4, 4, 4, 7, 7, 4)
            elsif ch (2) = "5"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
            elsif ch (2) = "6"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
            elsif ch (2) = "7"
                    then
                DrawThing (4, 7, 4, 7, 7, 7, 4)
            elsif ch (2) = "8"
                    then
                DrawThing (4, 4, 4, 4, 4, 4, 4)
            elsif ch (2) = "9"
                    then
                DrawThing (4, 4, 4, 4, 7, 4, 4)
            elsif ch (2) = "0"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
            end if
            end if
        end if
    end for
    exit when 10 < x and x < 60 and 10 < y and y < 60 and button = 1
end loop



I still can't get one number to show up; have it stay there for a bit and then go to the next number. Please tell me what I'm doing wrong

(I do realize there isn't much code for the second number. Like I said its late)

Thanks for all the help and looking forward to more
TheOneTrueGod




PostPosted: Mon Jun 05, 2006 6:47 am   Post subject: (No subject)

You want to have a for loop around the different characters.

for i : 1..length(ch)
if ch(i) = "1" then
%Etc, drawn out if here
...
end if
delay(1000)
end for
wtd




PostPosted: Mon Jun 05, 2006 10:24 am   Post subject: (No subject)

TheOneTrueGod wrote:
strings can be parsed just by using parenthesisYour welcome wtd Razz


Now, just spell "you're" correctly and I'll be happy.

Oh, and what you're doing idn't exactly what I'd call "parsing." Raher you're "indexing" the string.
5had0w




PostPosted: Mon Jun 05, 2006 4:04 pm   Post subject: (No subject)

ok so i've got almost everything that i want for this to work how i want it too.

The code now looks like this
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)

procedure DrawThing (v1, v2, v3, v4, v5, v6, v7 : int)
    %top
    drawfilloval (480, 350, 60, 10, v1)
    %top left
    drawfilloval (420, 290, 10, 60, v2)
    %top right
    drawfilloval (540, 290, 10, 60, v3)
    %middle
    drawfilloval (480, 230, 60, 10, v4)
    %bottom left
    drawfilloval (420, 170, 10, 60, v5)
    %bottom
    drawfilloval (480, 110, 60, 10, v6)
    %bottom right
    drawfilloval (540, 170, 10, 60, v7)
end DrawThing

procedure work
    locatexy (360, 40)
    put "                             " ..
    locate (2, 1)
end work

procedure dwork
    locatexy (360, 40)
    put "this character is too complex"
    locatexy (360, 40)

    locate (2, 1)
end dwork

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

var ch : string
var c : int
var x, y, button : int
locate (1, 1)
put "Press any keys. Will not reconize capitals. Enter in only one word at a time."


loop

    mousewhere (x, y, button)
    if hasch then
        get ch
        locatexy (360, 70)

        put "The character(s) entered is a(n):"
        locatexy (360, 60)
        put "", ch
        locate (2, 1)
        put "                                         " ..
        locate (2, 1)

        %number box display
        for i : 1 .. length (ch)
            if ch (i) = "1"
                    then
                DrawThing (7, 7, 4, 7, 7, 7, 4)
                work
            elsif ch (i) = "2"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
                work
            elsif ch (i) = "3"
                    then
                DrawThing (4, 7, 4, 4, 7, 4, 4)
                work
            elsif ch (i) = "4"
                    then
                DrawThing (7, 4, 4, 4, 7, 7, 4)
                work
            elsif ch (i) = "5"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
                work
            elsif ch (i) = "6"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
                work
            elsif ch (i) = "7"
                    then
                DrawThing (4, 7, 4, 7, 7, 7, 4)
                work
            elsif ch (i) = "8"
                    then
                DrawThing (4, 4, 4, 4, 4, 4, 4)
                work
            elsif ch (i) = "9"
                    then
                DrawThing (4, 4, 4, 4, 7, 4, 4)
                work
            elsif ch (i) = "0"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "a"
                    then
                DrawThing (4, 4, 4, 4, 4, 7, 4)
                work
            elsif ch (i) = "b"
                    then
                DrawThing (7, 4, 7, 4, 4, 4, 4)
                work
            elsif ch (i) = "c"
                    then
                DrawThing (4, 4, 7, 7, 4, 4, 7)
                work
            elsif ch (i) = "d"
                    then
                DrawThing (7, 7, 4, 4, 4, 4, 4)
                work
            elsif ch (i) = "e"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 7)
                work
            elsif ch (i) = "f"
                    then
                DrawThing (4, 4, 7, 4, 4, 7, 7)
                work
            elsif ch (i) = "g"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
                work
            elsif ch (i) = "h"
                    then
                DrawThing (7, 4, 4, 4, 4, 7, 4)
                work
            elsif ch (i) = "i"
                    then
                DrawThing (7, 4, 7, 7, 4, 7, 7)
                work
            elsif ch (i) = "j"
                    then
                DrawThing (7, 7, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "k"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "l"
                    then
                DrawThing (7, 4, 7, 7, 4, 4, 7)
                work
            elsif ch (i) = "m"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "n"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "o"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "p"
                    then
                DrawThing (4, 4, 4, 4, 4, 7, 7)
                work
            elsif ch (i) = "q"
                    then
                DrawThing (4, 4, 4, 4, 7, 7, 4)
                work
            elsif ch (i) = "r"
                    then
                DrawThing (7, 7, 7, 4, 4, 7, 7)
                work
            elsif ch (i) = "s"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
                work
            elsif ch (i) = "t"
                    then
                DrawThing (7, 4, 7, 4, 4, 4, 7)
                work
            elsif ch (i) = "u"
                    then
                DrawThing (7, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "v"
                    then
                DrawThing (7, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "w"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "x"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "y"
                    then
                DrawThing (7, 4, 4, 4, 7, 4, 4)
                work
            elsif ch (i) = "z"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
                work
            elsif ch (i) = "-"
                    then
                DrawThing (7, 7, 7, 4, 7, 7, 7)
                work
            end if
            delay (1000)
        end for
    end if
    if 10 < x and x < 60 and 10 < y and y < 60 and button = 1
            then
        locate (1, 1)
        put "you have quit the program"
        exit
    end if
end loop



The only other thing I want it to do is have it so i can put more than one word and have it go to the next word after the space and continue after the space.

eg. Hello my name is
rather than: Hello
my
name
is
Sponsor
Sponsor
Sponsor
sponsor
5had0w




PostPosted: Mon Jun 05, 2006 4:04 pm   Post subject: (No subject)

ok so i've got almost everything that i want for this to work how i want it too.

The code now looks like this
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)

procedure DrawThing (v1, v2, v3, v4, v5, v6, v7 : int)
    %top
    drawfilloval (480, 350, 60, 10, v1)
    %top left
    drawfilloval (420, 290, 10, 60, v2)
    %top right
    drawfilloval (540, 290, 10, 60, v3)
    %middle
    drawfilloval (480, 230, 60, 10, v4)
    %bottom left
    drawfilloval (420, 170, 10, 60, v5)
    %bottom
    drawfilloval (480, 110, 60, 10, v6)
    %bottom right
    drawfilloval (540, 170, 10, 60, v7)
end DrawThing

procedure work
    locatexy (360, 40)
    put "                             " ..
    locate (2, 1)
end work

procedure dwork
    locatexy (360, 40)
    put "this character is too complex"
    locatexy (360, 40)

    locate (2, 1)
end dwork

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

var ch : string
var c : int
var x, y, button : int
locate (1, 1)
put "Press any keys. Will not reconize capitals. Enter in only one word at a time."


loop

    mousewhere (x, y, button)
    if hasch then
        get ch
        locatexy (360, 70)

        put "The character(s) entered is a(n):"
        locatexy (360, 60)
        put "", ch
        locate (2, 1)
        put "                                         " ..
        locate (2, 1)

        %number box display
        for i : 1 .. length (ch)
            if ch (i) = "1"
                    then
                DrawThing (7, 7, 4, 7, 7, 7, 4)
                work
            elsif ch (i) = "2"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
                work
            elsif ch (i) = "3"
                    then
                DrawThing (4, 7, 4, 4, 7, 4, 4)
                work
            elsif ch (i) = "4"
                    then
                DrawThing (7, 4, 4, 4, 7, 7, 4)
                work
            elsif ch (i) = "5"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
                work
            elsif ch (i) = "6"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
                work
            elsif ch (i) = "7"
                    then
                DrawThing (4, 7, 4, 7, 7, 7, 4)
                work
            elsif ch (i) = "8"
                    then
                DrawThing (4, 4, 4, 4, 4, 4, 4)
                work
            elsif ch (i) = "9"
                    then
                DrawThing (4, 4, 4, 4, 7, 4, 4)
                work
            elsif ch (i) = "0"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "a"
                    then
                DrawThing (4, 4, 4, 4, 4, 7, 4)
                work
            elsif ch (i) = "b"
                    then
                DrawThing (7, 4, 7, 4, 4, 4, 4)
                work
            elsif ch (i) = "c"
                    then
                DrawThing (4, 4, 7, 7, 4, 4, 7)
                work
            elsif ch (i) = "d"
                    then
                DrawThing (7, 7, 4, 4, 4, 4, 4)
                work
            elsif ch (i) = "e"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 7)
                work
            elsif ch (i) = "f"
                    then
                DrawThing (4, 4, 7, 4, 4, 7, 7)
                work
            elsif ch (i) = "g"
                    then
                DrawThing (4, 4, 7, 4, 4, 4, 4)
                work
            elsif ch (i) = "h"
                    then
                DrawThing (7, 4, 4, 4, 4, 7, 4)
                work
            elsif ch (i) = "i"
                    then
                DrawThing (7, 4, 7, 7, 4, 7, 7)
                work
            elsif ch (i) = "j"
                    then
                DrawThing (7, 7, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "k"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "l"
                    then
                DrawThing (7, 4, 7, 7, 4, 4, 7)
                work
            elsif ch (i) = "m"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "n"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "o"
                    then
                DrawThing (4, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "p"
                    then
                DrawThing (4, 4, 4, 4, 4, 7, 7)
                work
            elsif ch (i) = "q"
                    then
                DrawThing (4, 4, 4, 4, 7, 7, 4)
                work
            elsif ch (i) = "r"
                    then
                DrawThing (7, 7, 7, 4, 4, 7, 7)
                work
            elsif ch (i) = "s"
                    then
                DrawThing (4, 4, 7, 4, 7, 4, 4)
                work
            elsif ch (i) = "t"
                    then
                DrawThing (7, 4, 7, 4, 4, 4, 7)
                work
            elsif ch (i) = "u"
                    then
                DrawThing (7, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "v"
                    then
                DrawThing (7, 4, 4, 7, 4, 4, 4)
                work
            elsif ch (i) = "w"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "x"
                    then
                DrawThing (7, 7, 7, 7, 7, 7, 7)
                dwork
            elsif ch (i) = "y"
                    then
                DrawThing (7, 4, 4, 4, 7, 4, 4)
                work
            elsif ch (i) = "z"
                    then
                DrawThing (4, 7, 4, 4, 4, 4, 7)
                work
            elsif ch (i) = "-"
                    then
                DrawThing (7, 7, 7, 4, 7, 7, 7)
                work
            end if
            delay (1000)
        end for
    end if
    if 10 < x and x < 60 and 10 < y and y < 60 and button = 1
            then
        locate (1, 1)
        put "you have quit the program"
        exit
    end if
end loop



The only other thing I want it to do is have it so i can put more than one word and have it go to the next word after the space and continue after the space.

eg. Hello my name is
rather than: Hello
my
name
is
5had0w




PostPosted: Mon Jun 05, 2006 4:06 pm   Post subject: (No subject)

i dont know why it posted twice but they are the same thing
sorry guys Laughing
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  [ 10 Posts ]
Jump to:   


Style:  
Search: