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

QUESTION 68 People who are _____ tend to be bold and independent, to value change, to...
QUESTION 68 People who are _____ tend to be bold and independent, to value change, to be more likely to smoke and to have more sexual partners, and to prefer spicy, sour, and crunchy foods. self-actualized high achievers high sensation seekers low sensation seekers 5 points    QUESTION 69 The term personality refers to the hereditary aspects of one's emotional nature. unique and enduring behavior patterns. favorable and unfavorable personal characteristics. charisma, character, or temperament. 5 points    QUESTION 70...
. 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.
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
Using Java, write the the following code. Only the bold needs to be answered Here is...
Using Java, write the the following code. Only the bold needs to be answered Here is the driver: package assign public class A3Driver { public static void main(String[] args) { //Test GSUStudent object GSUStudentWorker gsw = new GSUStudentWorker("Bunny","Bugs", 2000, 9, 8, 9001234); gsw.setGPA(3.7); gsw.setHourlyRate(10.00); gsw.setTotalHours(30); System.out.println(gsw); GSUStudentWorker gsw2 = new GSUStudentWorker("Bunny","Betty", 1999, 9, 8, 9002413); gsw2.setGPA(4.0); gsw2.setHourlyRate(10.00); gsw2.setTotalHours(45); System.out.println(gsw2); //Test GSUStoreSupervisor GSUStoreSupervisor gss = new GSUStoreSupervisor("Duck","Daffy", 1980, 9, 8); gss.setMonthlyPay(4000); System.out.println(gss); //test GSUSuperStudent GSUSuperStudent gsuper = new GSUSuperStudent("Mouse","Minny", 1990, 9,...
Please write this code in C++, also if you could please bold the names of the...
Please write this code in C++, also if you could please bold the names of the input files and provide comments for each choice. For this part, the program gives the user 4 choices for encrypting (or decrypting) the first character of a file. Non-lowercase characters are simply echoed. The encryption is only performed on lowercase characters. If c is char variable, then islower(c) will return true if c contains an lowercase character, false otherwise To read a single character...
True or False 6.    Sometimes nonverbal messages are substituted for verbal ones in a text conversation...
True or False 6.    Sometimes nonverbal messages are substituted for verbal ones in a text conversation 7.    How we dress communicates our culture? 8.    There can have a dyad relationship in a group of 3 people? 9.    Spirals happen when one partner takes a one-up position and the other takes a one-down position. 10. The final stage in a relationship is the stagnation stage?
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT