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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started