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...
The Ones That Walk Away From Omelas Text Please click on the link and read the...
The Ones That Walk Away From Omelas Text Please click on the link and read the following article -->https://docs.google.com/document/d/12n5cYjWs635zIapXxOSiRkTk2SjUWraGZRaoVCpwjfk/edit?usp=sharing Then answer the following question with a 200 word minimum response. You should show that you have a good understanding over the subject of Utilitarianism. 1) How can this short story be considered a critique of Utilitarianism? Is it a fair critique?
. 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...
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,...
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,...
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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT