You are asked to write a C program coPlot.c that will cooperate with the end-user, accept keyboard input during execution, and output the results based on the user's commands. More precisely, your program will support the following "commands" typed-in by the end-user during runtime:
1> Bit operations:
Logic Gate | Operands | Manipulation |
bit_or | < int1 >< int 2 > | bitwise OR of the two specified integers |
bit_and | < int1 >< int2 > | bitwise AND of the two specified integers |
bit_xor | < int1 >< int2 > | bitwise XOR of the two specified integers |
bit_shift_left | < s >< k > | shift the bits of the integer s k bits to the left |
bit_shift_right | < s >< k > | shift the bits of the integer s k bits to the right |
2> String Operations:
reverse < string > - reverse of the specified string
3> Termination:
exit - stop the execution of your program
When your program is started, it should ask the user for a command to run. Once the user types-in the command, your program should do the processing and print the results to the screen. This shall continue until the user types the exit command, at which point your program terminates.
Here is an example run:
:~> ./coPlot
>> Please enter a command to run.
bit_or 15 25
31
>> Please enter a command to run.
bit_and 15 25
9
>> Please enter a command to run.
bit_xor 15 25
22
>> Please enter a command to run.
reverse hello
olleh
>> Please enter a command to run. reverse CST_8234_Intro_to_C_Prog gorP_C_ot_ortnI_4328_TSC >> Please enter a command to run. exit
Good Bye!