Question: Programming Tasks 1.) Command Line Calculator a. Command Line Calculator for individual integer Numbers (simplecalc.qpp, simplecalc.exe) This is about creating a command line calculator. A

 Programming Tasks 1.) Command Line Calculator a. Command Line Calculator for
individual integer Numbers (simplecalc.qpp, simplecalc.exe) This is about creating a command line
calculator. A first number followed by an operator followed by a second
number is passed via command line as shown below UsersNorbertsinplecalc.exe 1 1
Depending on the operator, the numbers should be calculated accordingly. The operations

Programming Tasks 1.) Command Line Calculator a. Command Line Calculator for individual integer Numbers (simplecalc.qpp, simplecalc.exe) This is about creating a command line calculator. A first number followed by an operator followed by a second number is passed via command line as shown below UsersNorbertsinplecalc.exe 1 1 Depending on the operator, the numbers should be calculated accordingly. The operations addition, subtraction, multiplication, division, and modulo for integers are to be realized with the functions add (.), sub (...) mul ( ), diy(), and mod ( ) , respectively. Here and below, the three dots in parentheses after a function name are intended to indicate that the function expects arguments. These functions accept a first argument and a second argument, both of type int, via call-by-value. They should also accept a third argument of type bool by means of call-by-reference. The functions should return the result of the calculation as an integer (type int). If in the function div(.) or in the function mod (..) the second number is zero, the bool variable should be set to false and the first number is to be returned as result in this case. In all other cases the bool variable must be set to true. Please implement a complete solution of the task. Parts of it are already given below Your program should work as shown below: UsersNorbert sinplecalc.exe 11 Users Norbert>sinplecalc.exe 1-1 Users Norbert>sinplecalc.exe 2-2 24 UsersNorbert sinplecalc.exe 278 annot divide by zero :NUsers\Norbert)sinplecalc.exe 5 2 Please note that there need to be spaces between the entries on the command line for things to work well. C+ Code Snippets //your code here (also abbreviated below as //yours) /Ifunction prototypes int add(// your code here): int sub(//your code here) int mul(//your code here) int div(// your code heze) int mod(//your code heze) int main (int argc, char argvD //your code here (short: //yours) // your code here // your code here //your code here // your code here cout myoutputla.txt" on the command line. To this end, enter "simplecalc.exe 1+2 myoutput1atxt" on the command line without. Note myoutput1a.txt. This is a regular text file that can be opened, eg, using Notepad redirects program outputs to file, he 2. Run "fc myoutputla.txt correct1a.txt" on the command line. "f is a file comparison program. To do t comparison, download "correctlatr". If the contents of the two files are identical, then you will get a res similar to what is shown below. Users Norbertsinplecale.exe1 2 nyout putla.txt Users Norbert>fc nyoutputia.txt correctia.txt onparing files nyoutputla.txt and CORRECTIA.TXT C: no differences encountered Please note that there need to be spaces between the entries on the command line for things to work well b. Command Line Calculator for Fields of integer Numbers (veccalc.cpp, veccak.exel Now write an extended version of simplecalc that allows the processing of fields represented as vectorcint> in Ct+. The basic procedure is the same as for simplecalc. Only now two fields with integers are passed. They have to be processed element by element as shown below, e.g, for :Viser Horbert)vec cale.exe 1 2 3 4 6 ? 8 Elenentwise Sun 7-18 48- 12 Analogous to simplecal, the operations addition, subtraction, multiplication, division, and modulo are to be implemented. Again, the functions should be called add (m), sub (-), mul (), div (-), and mod (m), but this time they should operate on fields of type vectorcint>. Here and below, the three dots in parentheses after a function name are intended to indicate that the function expects arguments. If a zero is found in the second field during division or modulo calculation, a bool variable must be set to false. In this case, the corresponding number from the first field must be returned as the result of the operation. Since the solution of veccak is again a field, a corresponding output function is needed. Implement a suitable display() function. Follow the partially implemented function below. Please implement a complete solution of this task. Parts are already given in part. Your output should follow the following screen shot Elementuise Sun Elementuise Difference sersWerbert veccalexe765-4321 Elementuise Predact ivisen by zero eceured for at least one elenent Quot ient ed with respect to zere for at least one elenent Elenentuise Red Operat ion Please test that your output is formatted properly by performing the following steps 1. Run "veccak.exe 5678 /2 304> myoutput1b.tt" on the command line 2. Run fc myoutput 1b.txt correct1b.t on the command line as well after downloading the file correct1 b.txt" If the two files are identical, you receive an output similar to what is shown below :Visers\Norbert)vecca1c.exe S 6 7 / 2 3 @ 4 nyout put 1 b.txt NUsersNorbert>fc nyout put1b.txt cerrectlb.txt onparing files nyoutputib.txt and CORRECT1B.TXT C: ne differences encountered C++ Code Snippets /your code here (also abbreviated below as: 1/ yours //function prototypes vectornt> add (//yours) ; vectorcint> sub(//yourS vectorcint> mul (//yourS) vectorcint> div(//yours) vectorcint> mod (//yours void display(/yours) int main (int argc, char argv) // your code here /Note: a, b c are of type vectorcint> //you need to figure out their length //the variable status is of type bool t//yours) ) else if (//yours) ) else if (//yours) ) else if (//yours) c-add (a,b,status): display(a, b, c") c-sub(a,b,status) display (a, b, c, "-"); c-mul (a,b,status) display (a, b, c ) div ( a,b,status); C if (status) display (a, b,c,) else f cout

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!