Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: how to program my program to add random numbers?

by zek152 (Pilgrim)
on Aug 05, 2011 at 15:47 UTC ( [id://918810]=note: print w/replies, xml ) Need Help??


in reply to how to program my program to add random numbers?

Can you be a little more clear about what the teacher was unhappy about?

You don't have to have the $z = $x +|-|*|/ $y;. You can do the calculation in the print statement ({print "$x + $y = " . $x + $y . "\n";) and then you can remove the inefficient 3 checks (if the user entered "Add" it will still check to see if he entered sub,mult,div). Those should be elsifs.

This is all speculation as I can't read your teacher's mind. Hope this helps a little.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://918810]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2026-01-20 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (124 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.