SHOW:
|
|
- or go back to the newest paste.
| 1 | #!C:\Strawberry\perl\bin | |
| 2 | use warnings; | |
| 3 | ||
| 4 | my $stop = 0; | |
| 5 | until ($stop != 0) {
| |
| 6 | ||
| 7 | ||
| 8 | - | print "this program will compute the circumfrence of a circle.\n"; |
| 8 | + | print "this program will compute the circumfrence of a circle.\n"; |
| 9 | - | print "\n"; |
| 9 | + | print "\n"; |
| 10 | - | print "Please enter in the radius of your circle.\n"; |
| 10 | + | print "Please enter in the radius of your circle.\n"; |
| 11 | - | $radius = <STDIN>; |
| 11 | + | |
| 12 | - | until ($radius ne "\n") {
|
| 12 | + | until ($radius ne "\n") {
|
| 13 | - | print "please enter a number "; |
| 13 | + | print "please enter a number "; |
| 14 | $radius = <STDIN>; | |
| 15 | - | } |
| 15 | + | } |
| 16 | ||
| 17 | - | print "The radius of your circle is "; |
| 17 | + | print "The radius of your circle is "; |
| 18 | - | print 2 * 3.141592654 * $radius; |
| 18 | + | print 2 * 3.141592654 * $radius; |
| 19 | - | print "\n"; |
| 19 | + | print "\n"; |
| 20 | - | print "do you want to calculate another?(yes/no)\n"; |
| 20 | + | print "do you want to calculate another?(yes/no)\n"; |
| 21 | - | $stop = 0; |
| 21 | + | |
| 22 | - | $answer = <STDIN>; |
| 22 | + | $answer = <STDIN>; |
| 23 | - | if ($answer eq "no") {
|
| 23 | + | if ($answer eq "no") {
|
| 24 | - | print "exiting.... \n"; |
| 24 | + | print "exiting.... \n"; |
| 25 | - | $stop = 1; |
| 25 | + | $stop = 1; |
| 26 | ||
| 27 | - | } else {
|
| 27 | + | } else {
|
| 28 | $stop = 0; | |
| 29 | - | } |
| 29 | + | } |
| 30 | } |