I have a problem performing simple arithmetic operations. I want to hire you to write a calculator program for my UNIX COMPUTE. I need it to
perform addition, subtraction, multiplication, division, and exponentiation and possibility some other operations later.
The program should read operations from standard input and/or from a file. If it reads from a file then the file will contain all of the operations and data. If the program reads from standard input then the program is interactive. It should be able to do both.
The program is to be called xcalc. It is to be run from the UNIX command line prompt. A sample execution is below.
$calc file l file 2
$calc
$calc
It will read from the standard input and write to the standard output with the capability of i/o redirection. I also want the program to have the command line option capability to specify an output file
I have a problem performing simple arithmetic operations. I want to hire you to write a calculator program for my UNIX COMPUTE. I need it to perform addition, subtraction, multiplication, division, and exponentiation and possibility some other operations later. The program should read operations from standard input and/or from a file. If it reads from a file then the file will contain all of the operations and data. If the program reads from standard input then the program is interactive. It should be able to do both. The program is to be called xcalc. It is to be run from the UNIX command line prompt. A sample execution is below. $calc file l file 2 $calc < file="" 1="" $calc="" it="" will="" read="" from="" the="" standard="" input="" and="" write="" to="" the="" standard="" output="" with="" the="" capability="" of="" i/o="" redirection.="" i="" also="" want="" the="" program="" to="" have="" the="" command="" line="" option="" capability="" to="" specify="" an="" output="" file="" scale="" -o="" outputfilename="" inputfilenamel="" the="" numbers="" read="" are="" to="" be="" unsigned="" integers="" and="" the="" operations="" are="" to="" be="" in="" prefix="" form.="" the="" operations="" are="" addition,="" subtraction,="" multiplication,="" division,="" and="" exponentiation.="" the="" control="" d="" character="" (the="" unix="" end="" of="" file="" character)="" will="" end="" the="" program="" if="" it="" is="" interactive.="" the="" following="" sample="" list="" of="" operations="" should="" help="" clear="" up="" any="" confusion.="" "+11="" 11"="" "-22="" 11"="" "*22="" 2"="" "/="" 22="" 2"="" "e="" 2="" 3"="" the="" operation="" must="" be="" the="" very="" first="" character="" on="" the="" input="" line="" followed="" by="" 1="" or="" more="" blanks.="" any="" number="" of="" blanks="" can="" be="" before="" or="" after="" each="" operand.="" no="" blanks="" can="" be="" embedded="" into="" a="" number.="" sample="" execution="" and="" operation="" follows="" that="" illustrate="" interactive="" mode="" $="" xcalc="">>+ 11 22 >>11+22=33 >>*22 2 >>22 * 2 = 44 >> There is one arithmetic operation that can be used to implement all others. Determine which one and use it to implement all of the operations: "+, -, *, /, and e." If you cannot determine which operation is the "one magical all powerful operation" then try using addition "+". You should check for invalid operations and for division by zero. This program is to be developed using the principles discussed in class Each operation should be implemented as a function. See the example below. int add (int augend, int addend) { int sum; sum = augend + addend; return sum; } If you cannot figure out how to use addition "+" then use the : "+, -, *, /, and e." in a straight forward manner. int multiply (int multiplicand, int multiplier) { int product; product = multiplicand * multiplier; return product; }