Write a c program for a mini calculator

Assignment Help Computer Engineering
Reference no: EM132196750

Write a C program for a mini calculator using only the command line options. You must use getopt to parse the command line.

Usage: minicalc [-a num] [-d num] [-m num] [-s num] [-e] value The variable value is the starting value.

• Value should be validated to be an integer between 1 and 99. Error message and usage shown if not.

• -a adds num to value. • -d divides value by num.

• -m multiplies value by num. • -s subtracts num from value.

• -e squares value. (Note: no num is needed.)

• Output should have exactly 2 decimal places no matter what the starting values are.

• If -e is included, it is executed first.

• Use standard order of operations for all operations.

Code should be nicely indented and commented.

Create a simple Makefile to compile your program into an executable called minicalc. You should submit the source code, your Makefile and a screenshot of the output file.

Reference no: EM132196750

Questions Cloud

Change should always be tested in the test environment : When configuring and testing a change in the environment, the change should always be tested in the "Test" environment.
What is the expenditure function : Preferences are modelled by an indirect utility function v(p1, p2, p3, y) = y p p1(p2 + p3) , where y denotes total breakfast spending and (p1, p2, p3).
Print out each command line argument on a separate line : Write a C program that will print out each command line argument on a separate line. However, you should print them out in reverse order.
What is the optimal output level : Is the current market level of production for this good socially optimal? If not, what is the optimal output level? Explain using a graph.
Write a c program for a mini calculator : Write a C program for a mini calculator using only the command line options. You must use getopt to parse the command line.
Consequences of overestimating verse underestimating demand : What are the consequences of overestimating verse underestimating demand?
Display the largest and second largest values : Write a C++ program that reads integers from a file on disk and then displays the largest and second largest values. You must use a C++ loop in this program.
Write a c program that uses splint and flags as many errors : Write a C program that uses splint and flags as many errors as possible from the list of all the errors shown : Dereferencing a possibly null pointer;
Determine which should be taxed more : If the government wants to raise a particular level of revenue in a way which minimises dead weight loss then should CRGs and RPGs be taxed similarly.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Create a program that asks the user to enter an objects mass

Create a program that asks the user to enter an objects mass, then calculates its weight. Must use if-else statements to write your program.

  Case study asymmetric and symmetric encryption

Case Study Asymmetric and Symmetric Encryption

  What is difference between size and the capacity of vector

What is the difference between the size and the capacity of a vector? Why do we have a constructor that lets us set the initial capacity?

  Implement simple global constant identifiers

Implement simple global constant identifiers - Generate the correct machine code instruction to load a constant value into a register when a constant IDENT in the factor rule is recognised.

  Decision-making process

Banner advertising on the Web sites helps activate the realization that there is a gap between the reality and desired state that happens in the --------------- stage of EC purchase decision-making process.

  Define a formal information systems security plan

Effective information security recommendations must be incorporated into a formal information systems security plan

  Explain how the hadoop system deals with datanode failures

Explain in detail how the Hadoop system deals with DataNode failures. Explain and write the pseudocode for a Mapper/Reducer that takes as input a large file (possibly split into chucks) of integers and outputs.

  Devise a two-dimensional facility layout package

Devise a two-dimensional facility layout package, that presents a menu of farinose shapes. A two-level hierarchy is to be used so that furniture items.

  What does this following algorithm calculate

What does this following algorithm calculate

  Calculate the average test score and display it

Write a program that asks for five test scores. The program should calculate the average test score and display it. The number displayed should be formatted in fixed-point notation, with one decimal point of precision.

  How to use array list and int field to implement an iterator

Describe how to use an array list and an int field to implement an iterator. Include pseudo-code fragments describing hasNext() and next().

  Create a prototype of a stand-alone website

COIT 20268 - Responsive Web Design (RWD). To complete the given project specified in the Background section above, you are to create a prototype of a stand-alone website for a desktop computer

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd