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

Username:   Password: 
 RegisterRegister   
 binary typer
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
person




PostPosted: Sat Mar 05, 2005 5:40 pm   Post subject: binary typer

code:

var win := Window.Open ("position:0;0,graphics:650;max")
var i : string (1)
var num : int
loop
    getch (i)
    num := ord (i)
    if num = 1 then
        put "0000000", intstr (num, 0, 2), " " ..
    elsif num = 2 or num = 3 then
        put "000000", intstr (num, 0, 2), " " ..
    elsif num >= 4 and num <= 7 then
        put "00000", intstr (num, 0, 2), " " ..
    elsif num >= 8 and num <= 15 then
        put "0000", intstr (num, 0, 2), " " ..
    elsif num >= 16 and num <= 31 then
        put "000", intstr (num, 0, 2), " " ..
    elsif num >= 32 and num <= 63 then
        put "00", intstr (num, 0, 2), " " ..
    elsif num >= 64 and num <= 127 then
        put "0", intstr (num, 0, 2), " " ..
    else
        put intstr (num, 0, 2), " " ..
    end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
ssr




PostPosted: Mon Mar 07, 2005 6:51 pm   Post subject: (No subject)

ok..
I donno what it actually do but its a nice job. Very Happy
person




PostPosted: Mon Mar 07, 2005 6:58 pm   Post subject: (No subject)

Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance Dance

1) i actually got an reply

2) it just translates ur keyboard input into binary
ssr




PostPosted: Mon Mar 07, 2005 7:14 pm   Post subject: (No subject)

oh ok
thats a nice code Very Happy
Bacchus




PostPosted: Mon Mar 07, 2005 7:48 pm   Post subject: (No subject)

so does this handy little function i made b4:
code:
fcn binary (x : string (1)) : string
    var ordinal : int := ord (x)
    var done : int := 0
    var done2 : string := ""
    for i : 0 .. 7
        if ordinal - (128 / (2 ** i)) >= 0 then
            done += round ((10000000 / (10 ** i)))
            ordinal -= round ((128 / (2 ** i)))
        end if
    end for
    done2 := intstr (done)
    if length (done2) < 8 then
        for i : 1 .. 8 - length (done2)
            done2 := "0" + done2
        end for
    end if
    result done2
end binary
(ps. this is basis for that binary converter i made b4, and that was b4 i knew of the base thing lol)
ssr




PostPosted: Mon Mar 07, 2005 7:58 pm   Post subject: (No subject)

yepyep
both are very good code
lol
Laughing
may be I should make one too...
dann_west




PostPosted: Fri May 06, 2005 2:16 pm   Post subject: Re: binary typer

Pretty great guy!!!
Twisted Evil Twisted Evil Twisted Evil Twisted Evil Twisted Evil Twisted Evil Twisted Evil
Jorbalax




PostPosted: Sun May 08, 2005 9:33 pm   Post subject: (No subject)

Quote:
Posted: Mon Mar 07, 2005 8:58 pm

----------------------------------------------------------------
Quote:
Necro posting
Okay people, there has been a lot of useless posting in old topics lately.

Please stop doing this unless you have a good point to add. All of the posts are tagged with a date, and if it's six months old, it's a safe call not to post in it.

Thanks.


Not 6 months, but still...
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: