Question: Q2: write a C++ program that ask user to enter the string lets say your string can be sikandar. Perform the following tasks mentioned below

Q2: write a C++ program that ask user to enter the string lets say your string can be sikandar. Perform the following tasks mentioned below

1) Print the ASCII value of each character of string. 2) Write a function encode that encode the input string and display the encoded string on the console. You can encode the input string by extracting the ASCII value of each character and add integer value 2 in it in each character. 3) Write a function decode that decode the input string by subtracting value 2 from each character of the input string. Display the original string on the console. 4) Divide the string into two halves lets say sika will be your first part and ndar will be your second part. Your task is to exchange the every second element of the input string. For example, charcter i will be exchanged to d and a will be to r. when you are done with that display the string on the console. 5) Write a function displayElement that display the element of string which is coming more than once in entire input string.

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!