Question: In C programming, program implements a simple calculator that reads input from keyboard in the postfix notation, and performs calculation for floating-point numbers. You can

In C programming, program implements a simple calculator that reads input from keyboard in the postfix notation, and performs

calculation for floating-point numbers. You can create the executable calc by entering the com- mand make. Run the program a few times to become familiar with it. Your tasks in this asignment is to convert the code from floating-point calculation to integer calculation mostly replacing double with int. The original code uses atof() to convert ASCII to a floating-point number. You can use atoi() to convert ASCII to integer. Additionally, you add functionality to the calculator by impementing the following operations. Four bitwise operations: AND (&), OR (|), XOR (^), and NOT (). Note that AND, OR, and XOR are binary operators, but NOT is a unary operator. For example, a b & is the bitwise AND of a and b; a is the bitwise NOT of a. Three comparison operations: GREATER-THAN (>), EQUAL-TO (=), and LESS-THAN (<). The resulting values are either zero or one. Note that EQUAL-TO is denoted =, rather than == as in C. One logical operation NOT (!). It returns zero for a non-zero number, and returns one for zero. For example, 0 ! is 1, and 5 ! is 0. One ternary operation ?: The usual ternary expression a ? b : c in C will be written as c b a ?. If a is non-zero, the value of the expression is b, otherwise it is c.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!