Question

In: Computer Science

Change the ones with Bold text on the code accordingly. The code within the if statement...

Change the ones with Bold text on the code accordingly.

The code within the if statement is not doing the correct process. When your code goes to the c2 function it should be passing argv[1] to it.

(side note: your program design of calling the function c1(), c2() c3() is a bit odd, but it can work)

if (argv[2] == _c2)   
                {
                        ret = c1(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit
 
                }
                else if (argv[2] == _c1)
                {
                        ret = c2(argv[1]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit // this should be done in the c2() funciton
                }
                else if (argv[1] == _c3)
                {
                        ret = c3(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit // this should be done in the c2() funciton
                }
                else if (argv[1] == _c4)
                {
                        ret = c4(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit  // this should be done in the c2() funciton
                }
                else {
                        cout << "'V' - Invalid operation selection" << endl;
                        exit(0);
                }

Solutions

Expert Solution

Given :

To change the ones with Bold text on the code accordingly.

if (argv[2] == _c2)   
                {
                        ret = c1(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit
 
                }
                else if (argv[2] == _c1)
                {
                        ret = c2(argv[1]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit // this should be done in the c2() funciton
                }
                else if (argv[1] == _c3)
                {
                        ret = c3(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit // this should be done                                   in the c2() funciton
                }
                else if (argv[1] == _c4)
                {
                        ret = c4(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit  // this should be done  in the c2() funciton
                }
                else {
                        cout << "'V' - Invalid operation selection" << endl;
                        exit(0);
                }

Given to change the text given on bold.They are just comments on c/c++.Those comments do not effect the actual program.However , the modified comments with the code is given below:

if (argv[2] == _c2)   
                {
                        ret = c1(argv[2]);
                        ret = ret >> 2;           //divide by 2 to make it 8 bit
 
                }
                else if (argv[2] == _c1)
                {
                        ret = c2(argv[1]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit // this should be done                        in the c1() function since else if(argv[2]== _c1)
                }
                else if (argv[1] == _c3)
                {
                        ret = c3(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit // this should be done in the c3() function since else if(argv[1]== _c3)
                }
                else if (argv[1] == _c4)
                {
                        ret = c4(argv[2]);
                        ret = ret >> 2;//divide by 2 to make it 8 bit  // this should be done in the c1() function
                }
                else {
                        cout << "'V' - Invalid operation selection" << endl;
                        exit(0);
                }

Related Solutions

Whats the code to open a text file and every line in that text file that...
Whats the code to open a text file and every line in that text file that starts with # then it should delete that line In python using .strip
. List the steps that used to write the text and change text properties inside the...
. List the steps that used to write the text and change text properties inside the drawing object.
javaFX is there a way to change the text of a button and then that button...
javaFX is there a way to change the text of a button and then that button repeats to actions of the first button
Using C++, write a code that this program always stores text file output into a text...
Using C++, write a code that this program always stores text file output into a text file named "clean.txt". -The program should read one character at a time from "someNumbers.txt", and do the following. -If it is a letter, print that letter to the screen, AND also store it in the text file. All letters should be converted to lowercase beforehand. -If it is a number, print that number to screen, but do NOT store it in the text file....
For each question state whether the statement in bold is true, false or uncertain. Give a...
For each question state whether the statement in bold is true, false or uncertain. Give a precise and concise justification for your answer. Your justification may include graphs if necessary. (a) If leisure is normal, the labor supply curve is always “backward bending.” (b) Sam receives half of his income in wages and half of his income in dividends. He currently takes negligible leisure. Sam would be indifferent between a 5% increase in his wage rate and a 5% increase...
The following CSS code is embedded on a webpage: p { font-weight: bold; font-style: italic; }...
The following CSS code is embedded on a webpage: p { font-weight: bold; font-style: italic; } Which of the following statements is true when the above webpage is shown on a browser? Group of answer choices(A-D) a. All paragraphs are displayed in bold but not in italic, since the browser will only execute the first CSS rule and ignore all subsequent rules. B. All paragraphs are displayed in italic but not in bold, since the browser will only execute the...
I don't know how to build my last code for TestPairOfDice...below the question is in bold....
I don't know how to build my last code for TestPairOfDice...below the question is in bold. I'm including my code for the previous problems which are all needed for number 6 1. Implement a method named surface that accepts 3 integer parameters named width, length, and height as user input. It will return the total surface area (6 sides) of the rectangular box it represents. The formula for Surface Area is 2(length * width) + 2(length * height) + 2(height...
Create a JAVA code program: Huffman code will be converted to its text equivalent Output an...
Create a JAVA code program: Huffman code will be converted to its text equivalent Output an error message if the input cannot be converted I can give an thumbs up! :)
Here is a statement: “The concepts of probability and statistics are powerful ones and contribute extensively...
Here is a statement: “The concepts of probability and statistics are powerful ones and contribute extensively to the solutions of many types of engineering problems”. What would be the best way to answer the following: Why, in your own words, do you think in your specifically engineering professional practice, probability and statistics will help you to be successful?
1. Read the following statement carefully: “The concepts of probability and statistics are powerful ones and...
1. Read the following statement carefully: “The concepts of probability and statistics are powerful ones and contribute extensively to the solutions of many types of engineering problems”. Answer the following: Why, in your own words, do you think in your specifically engineering professional practice, probability and statistics will help you to be successful?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT