
Concept explainers
C++ starter code
/* Cipher Lab using C strings */
/* Running the program looks like:
Enter some lower-case text: hello
Shifting 0 gives: hello
Shifting 1 gives: ifmmp
Shifting 2 gives: jgnnq
Shifting 3 gives: khoor
Shifting 4 gives: lipps
Shifting 5 gives: mjqqt
Shifting 6 gives: nkrru
Shifting 7 gives: olssv
Shifting 8 gives: pmttw
Shifting 9 gives: qnuux
Shifting 10 gives: rovvy
Shifting 11 gives: spwwz
Shifting 12 gives: tqxxa
Shifting 13 gives: uryyb
Shifting 14 gives: vszzc
Shifting 15 gives: wtaad
Shifting 16 gives: xubbe
Shifting 17 gives: yvccf
Shifting 18 gives: zwddg
Shifting 19 gives: axeeh
Shifting 20 gives: byffi
Shifting 21 gives: czggj
Shifting 22 gives: dahhk
Shifting 23 gives: ebiil
Shifting 24 gives: fcjjm
Shifting 25 gives: gdkkn
*/
#include <iostream>
#include <iomanip>
#include <cctype>
using namespace std;
// Global constants
const int MaxWordSize = 81; // 80 characters + 1 for NULL
// Given an array of characters and a shift value:
// shift each character in the original text by some amount,
// storing the result into the shiftedText array.
// Remember: Wrap around at the end of the alphabet.
// *** In the line below you must supply the function
// return type and the parameter(s) ***
? shiftTheText( ? )
{
// Loop through each character in the C string, startingText
// When the character is an alphabetic character,
// shift it by adding the shift value.
// Then store the resulting character in its proper spot
// in the shiftedText C string.
}
int main()
{
// Initialize the variables
char startingText[ MaxWordSize];
char shiftedText[ MaxWordSize];
cout << "Enter some lower-case text: ";
cin >> startingText;
for( int shiftValue = 0; shiftValue < 26; shiftValue++) {
// In the function call below you need to pass the starting text array, the shift value, and the shifted text array.
shiftTheText( );
cout << "Shifting " << setw( 2) << shiftValue << " gives: " << shiftedText << endl;
}
return 0; // Keep C++ happy
}// end main()


Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

- In vim, when the cursor is on the first letter of a word, you may capitalise it by typing x and then plarrow_forwardint main(){ string str; int count = 0; // user input cout << "Enter string: "; cin >> str; int n = str.length(); // iterating over the string for (int i = 0; i < n - 1; i++) { // calling the fucntion to find the palidrome strings from the user input if (isPalindrome(0, i, str) && isPalindrome(i + 1, n - 1, str)) { // if 2 substring are palindrome then print them and increment count for (int x = 0; x < i + 1; x++) cout << str[x]; cout << " "; for (int x = i + 1; x < n; x++) cout << str[x]; count++; // break the loop after printing the palindrom string break; } } // if count is 0 then no palindrome subtring pair found if (count == 0) cout << "NO";} change this code to stdio.h string.harrow_forwardAlert dont submit AI generated answer. Please code in C language.arrow_forward
- c++ progamming Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is "quit". If the input is:arrow_forwardDrawa structured flowchart , C++, write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have a fellow student try to guess it following your instructions.arrow_forwardC++arrow_forward
- python3 program : Write a function that removes all spaces from a given string string and returns the new string.arrow_forwardUse For loop please C++ given code /* Cipher Lab using C strings */ /* Running the program looks like:Enter some lower-case text: helloShifting 0 gives: helloShifting 1 gives: ifmmpShifting 2 gives: jgnnqShifting 3 gives: khoorShifting 4 gives: lippsShifting 5 gives: mjqqtShifting 6 gives: nkrruShifting 7 gives: olssvShifting 8 gives: pmttwShifting 9 gives: qnuuxShifting 10 gives: rovvyShifting 11 gives: spwwzShifting 12 gives: tqxxaShifting 13 gives: uryybShifting 14 gives: vszzcShifting 15 gives: wtaadShifting 16 gives: xubbeShifting 17 gives: yvccfShifting 18 gives: zwddgShifting 19 gives: axeehShifting 20 gives: byffiShifting 21 gives: czggjShifting 22 gives: dahhkShifting 23 gives: ebiilShifting 24 gives: fcjjmShifting 25 gives: gdkkn*/ #include <iostream>#include <iomanip>#include <cctype> using namespace std; // Global constantsconst int MaxWordSize = 81; // 80 characters + 1 for NULL // Given an array of characters and a shift value:// shift each character…arrow_forwardHelp plzarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





