![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pleas help..this is driving me crazy | hckygoli31 | Shell Programming and Scripting | 0 | 05-13-2008 05:59 AM |
| Test-driving OpenOffice.org 3.0 | iBot | UNIX and Linux RSS News | 0 | 04-04-2008 12:10 PM |
| Dumb question but its driving me nuts | jepombar | UNIX for Dummies Questions & Answers | 3 | 07-03-2007 03:32 PM |
| Simple test driving me mad! | alarmcall | Shell Programming and Scripting | 6 | 10-27-2003 10:29 AM |
| unix driving me crazy | Tendernisin | UNIX for Dummies Questions & Answers | 1 | 11-29-2001 10:38 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Sweet
Everything is functioning now. Next I'll try to convert it into subroutines like another poster suggested. I have to do some reading up.
##################### print 'Welcome to the Calculator.'; print "\n\n"; print 'Would you like to enter the calculator? Please Type y or n: '; $run = <stdin>; chomp $run; # FIXED THE PROBLEM while ($run eq "y") { { print "Add = 1 | Subtract = 2 | Multiply = 3 | Divide = 4 |Exponent = 5 | Mod = 6 \n"; print 'Enter the corresponding number to the caluclation to be performed:'; $calc = <stdin>; chomp $calc; print 'Please enter the first value: '; $A = <stdin>; chomp $A; print 'Please enter the second value: '; $B = <stdin>; chomp $B; if($calc == 1) { $answer = $A + $B; } elsif($calc == 2) { $answer = $A - $B; } elsif($calc == 3) { $answer = $A * $B; } elsif($calc == 4) { $answer = $A / $B; } elsif($calc == 5) { $answer = $A ** $B; } elsif($calc == 6) { $answer = $A % $B; } print "The answer is $answer .\n"; } print 'Would you like to perform another calculation? Please Type y or n: '; $run = <stdin>; #FIXED THE PROBLEM chomp $run; } print 'The application is now terminated.'; [/CODE] Thank You everyone. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|