Question: PLEASE INCLUDE THE FULL PROGRAM INCLUDING THE INPUT AND OUTPUT REDIRECTION METHOD Programming In C Lab 3 B Objective To gain expertise in the use
PLEASE INCLUDE THE FULL PROGRAM INCLUDING THE INPUT AND OUTPUT REDIRECTION METHOD
Programming In C
Lab B
Objective
To gain expertise in the use of repetition, character processing, functions, parameter passing, inputoutput
redirection and command line.
Assignment
Write a program to perform a simple arithmetic calculation. The user is to enter a simple expression integer
operator integer such as:
The program is to extract the operands and the operator one character at a time, perform the indicated
calculation and display the result or print out an appropriate error message. For example:
Operators should include
Operands are positive integers, no sign
Use getchar function to read the expression
Use putchar function to output the expression
Expression will have variable spacing before the first operand, between operator and operands and
after the second operand zero one or more spaces
Your program needs to be in a loop asking whether the user wants to enter another expression with a
YN type of an answer one character
Code a function for each operator to do the appropriate operation functions
No global variables, arrays, string andor character handling functions may be used in this lab.
Your program needs to generate an appropriate error message if the expression is invalid.
You may ONLY use getchar and putchar functions for reading and writing the expression. You may
use scanf and printf functions for user prompts, error messages, etc.
Input
One expression at a time with user prompts to repeat.
Output
The whole expression entered by the user EXACTLY as typed in including spaces the result or an appropriate
error message. Need to show all test cases and scenarios for valid and invalid expressions there are many
and how your program handled it
Run
Create an input file of all valid and invalid expressions and answer to user prompts. Run the program on the
command line using inputoutput redirection:
Labbexe labbinput.txt labboutput.txt
Turn In
Turn in source code, input file and output file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
