Question
Write a program that takes a string of 21 characters and shift the content (left or right) by a given amount. Details You will be
Write a program that takes a string of 21 characters and shift the content (left or right) by a given amount.
Details
You will be given the string properly initialized where the last element (position 20) is going to be the null character '\0'.
You will be given the shift amount as an integer number (positive or negative)
A shift to the left is going to be represented by negative numbers and to the right by positive numbers.
You must only print out the resulting shifted string.
Note: the last character of your string must be always the null character.
Example 1:
When the input is:
Shift: 4, String: How are you, World!?
The output is
ld!?How are you, Wor
Example 2:
When the input is:
Shift: -5, String: How are you, World!?
The output is
re you, World!?How a
please print in c++ like using printf and scanf, not cout and cin
#include
int main() {
/* Type your code here. */
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started