If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
Post a reply to the thread: Anyone have a perl code that prints out a 3 row abacus given any number from 1 to 999?
Click here to log in
What is the sum of 36 and 12
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.
Anyone have a perl code that prints out a 3 row abacus given any number from 1 to 999? I have started a code that prints one row, but can't get that to work even. The first row should represent 1-9, the second row 10-90 and the third 100-900. #!/usr/bin/perl # a program to simulate a one-row playpen abacus $abacus = "UUUUUUUUUU "; # I put a space at the end. See below while (1){ print "\n$abacus\n? "; # pick up the string $us = <STDIN>; # convert string to array @us = split //, $us; for $i (@us){ # for each item in array if ($i eq 'U'){ $abacus =~ s/U / U/;# move space to left } } }
Anyone have a perl code that prints out a 3 row abacus given any number from 1 to 999?
Forum Rules