Coder Profile - Show off your skills, get a coder profile.
 
 
 
The Author
otoom
Ant
Send A Message
Rating
Not
Rated
Please login to rate source codes.

Click here to register a free account with us.
General Details
Perl
Posted 4.5 Years Ago
546 Views
Received 0 Ratings
More Codes By This Author
Guessing Game
Even or Odd
Even or Odd
Head First PHP And mySQL...
CreateSquare
Articles By This Author
Quick Threading Tutorial...
First look at C
Cheat Sheet Pack
[PHP] How to make a log f...
HTML Cheat Sheet!

Simple Calculator


Description
Can do simple sums. For example

1 + 1

Also can Square numbers.

5 * 5
Technical
When it asks you for what you would like to do, ie... 1. Add.
Enter the number,
Source Code
Comments
Please login to post comments.
 
otoom     Posted 2.68 Years Ago
 
 
Because i had problems with that mate.
 
VBAssassin     Posted 2.71 Years Ago
 
 
Oh also... why have you used: if ($option eq 1)

eq is used for comparison of strings... just use == for numerical scalar
comparison.

Kind regards,
Scott
 
VBAssassin     Posted 2.71 Years Ago
 
 
Damn... thats a lot of code for a calculator... i just wrote this out in a minute and
it can workout anything Perl can evaluate including variables (though they require
my, remove use strict to get rid of that).

#!/usr/bin/perl -w
use strict;
#get the sum to evaluate
chomp(my $sum = <STDIN>);
#display it
print " = ";
eval "print $sum";
print "\n";
 
VBAssassin     Posted 4.4 Years Ago
 
 
I see you've modified it. Much better!

Now how would you make i remember past sums such as the ability to do this kind of
thing:

1 + 2 = 3
+ 2 = 5
- 3 = 2

Kind regards,
Scott
 
VBAssassin     Posted 4.4 Years Ago
 
 
Whats

"This is a calculator. To Square a number. Only enter a number for number one.
Leave two blank. \n Thank you!"

All about? My calculator does not say that *checks* lol.

Kind regards,
Scott
Page 1 of 1
More "Perl" Source Codes By This Author
Recently Posted "Perl" Source Codes
Recently Rated "Perl" Source Codes
 
 
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?

Not enough time to do something productive
I run out of ideas
Too hard to show people my creations
Everything i do has too many errors, and it's too hard
I don't get bored!!!


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.20 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved