c pointers and structs assignment 1

struct Calculator {
long long LHValue;
long long * RHValue;
char lastOperator;

Pointers and Structs
We will be creating a calculator program that uses a struct definition provided to you. Your program will:

Declare a Calculator object, and initialize it

0 for both values and + for last operator will be good
You’ll have to initialize the pointer (with “new”) before initializing its value!

Accepts a line of input that will be read like a calculator

Valid operations – The user is prompted, then, without choosing, just provides one of the below patterns

Full expressions: 3+5, when entered, displays/stores 8 (Used below)
Partial expressions: +1, when entered, uses the previous results as a starting point. Continuing from the above example, displays/stores 9
Repeat last operation: =, when entered, uses the previous operation’s results with the same operator and Right Hand value. If entered after the above statement, would display/store 10.

You can make this run when no input is provided, just document it and let me know as the user!

Quit: q, when entered, ends the execution of the program

Apart from any whitespace that may be in the input string, any characters that are neither digits, an operator (+-*/%), or the quit command, should not be accepted; meaning the calculator command is rejected with a message given to the user. If the user’s input is rejected, no action should be taken.

Based on the user’s valid input, appropriately calculate, display, and store the answer in the LHValue member of your Calculator object

void processInput(Calculator * calc, string userInput)
Function definition above must be used (argument types can’t be changed)

Repeat step 2

Note: Don’t allow for division by 0!
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!Use Discount Code “Newclient” for a 15% Discount!NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.


"Is this question part of your assignment? We Can Help!"

Essay Writing Service