C++ this is the code i am having the following error in the png   #include #include #include #include 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) *** void shiftTheText(char startingText[], int shiftVal, char shiftedText[]) { // 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. size_t a = strlen(startingText); for(int i=0; i122) temp-=26; shiftedText[i] = (char)temp; }   } 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(startingText,shiftValue,shiftedText); cout << "Shifting " << setw( 2) << shiftValue << " gives: " << shiftedText << endl; } return 0; // Keep C++ happy }// end main()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++

this is the code i am having the following error in the png

 

#include <iostream>
#include <iomanip>
#include <cctype>
#include <string.h>

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) ***
void shiftTheText(char startingText[], int shiftVal, char shiftedText[])
{
// 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.
size_t a = strlen(startingText);
for(int i=0; i<a; i++){
int temp = (int)startingText[i];
temp+=shiftVal;
if(temp>122)
temp-=26;
shiftedText[i] = (char)temp;
}

 


}


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(startingText,shiftValue,shiftedText);
cout << "Shifting " << setw( 2) << shiftValue << " gives: " << shiftedText << endl;
}

return 0; // Keep C++ happy

}// end main()

2: Check 2 a
Output differs. See highlights below.
Input
mzckdxnx/tg.odw:odndq
Enter some lower-case text: Shifting
O gives: mzckdxnx/tg.odw:odndg
Shifting 1 gives: nadleyoyouh/pex;peoer
Shifting 2 gives: obemfzpzlvi0gfy<gfpfs
3 gives: pcfngaqa2wjlrgz=rgggt
4 gives: qdgohbrb3xk2sha>shrhu
5 gives: rehpicsc4yl3tib?tisiv
6 gives: sfigjdtd5zm4ujceujtjw
7 gives: tgjrkeue6an5vkdAvkukx
8 gives: uhkslfvf7bo6wleBwlvly
9 gives: viltmgwg8cp7xmfCxmwmz
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting 10 gives: wjmunhxh9dq8yngDynxna
Shifting 11 gives: xknvoiyi:er9zohEzoyob
Shifting 12 gives: ylowpjzj;fs:apiFapzpc
Your output
Shifting 13 gives: zmpxgkak<gt;bgjGbgagd
Shifting 14 gives: anqyrlbl=hu<crkHcrbre
Shifting 15 gives: borzsmcm>iv=dslIdscsf
Shifting 16 gives: cpsatndn?jw>etmJetdtg
Shifting 17 gives: dqtbuoeo@kx?funKfueuh
Shifting 18 gives: erucvpfpAly@gvoLgvfvi
Shifting 19 gives: fsvdwąggBmzAhwpMhwgwj
Shifting 20 gives: gtwexrhrCnaBixqNixhxk
Shifting 21 gives: huxfysisDobcjyrojyiyl
Shifting 22 gives: ivygztjtEpcDkzsPkzjzm
Shifting 23 gives: jwzhaukuFqdElatQlakan
Shifting 24 gives: kxaibvlvGreFmbuRmblbo
Shifting 25 gives: lybjCwmwHsfGncvSncmcp
Enter some lower-case text: Shifting
O gives: mzckdxnx/tg.odw:odndg
Shifting 1 gives: nadleyov/uh.pex:peoer
2 gives: obemfzpz/vi.gfy:gfpfs
3 gives: pcfngaqa/wj.rgz:rgggt
4 gives: qdgohbrb/xk.sha:shrhu
5 gives: rehpicsc/yl.tib:tisiv
6 gives: sfiqjdtd/zm.ujc:ujtjw
7 gives: tgjrkeue/an.vkd: vkukx
8 gives: uhkslfvf/bo.wle:wlvly
9 gives: viltmgwg/cp.xmf: xmwmz
Shifting 10 gives: wjmunhxh/dg. yng: ynxna
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting
Shifting 11 gives: xknvoiyi/er.zoh:zoyob
Shifting 12 gives: ylowpjzj/fs.api:apzpc
Expected output
Shifting 13 gives: zmpxqkak/gt.bqj:bgagd
Shifting 14 gives: angyrlbl/hu.crk:crbre
Shifting 15 gives: borzsmcm/iv.dsl:dscsf
Shifting 16 gives: cpsatndn/jw.etm:etdtg
Shifting 17 gives: dqtbuoeo/kx.fun: fueuh
Shifting 18 gives: erucvpfp/ly.gvo:gvívi
Shifting 19 gives: fsvdwggg/mz.hwp:hwgwj
Shifting 20 gives: gtwexrhr/na.ixg:ixhxk
Shifting 21 gives: huxfysis/ob.jyr:jyiyl
Shifting 22 gives: ivygztjt/pc.kzs:kzjzm
Shifting 23 gives: jwzhauku/gd.lat:lakan
Shifting 24 gives: kxaibvlv/re.mbu:mblbo
Shifting 25 gives: lybjcwmw/sf.ncv:ncmcp
3: Hidden Check a
Transcribed Image Text:2: Check 2 a Output differs. See highlights below. Input mzckdxnx/tg.odw:odndq Enter some lower-case text: Shifting O gives: mzckdxnx/tg.odw:odndg Shifting 1 gives: nadleyoyouh/pex;peoer Shifting 2 gives: obemfzpzlvi0gfy<gfpfs 3 gives: pcfngaqa2wjlrgz=rgggt 4 gives: qdgohbrb3xk2sha>shrhu 5 gives: rehpicsc4yl3tib?tisiv 6 gives: sfigjdtd5zm4ujceujtjw 7 gives: tgjrkeue6an5vkdAvkukx 8 gives: uhkslfvf7bo6wleBwlvly 9 gives: viltmgwg8cp7xmfCxmwmz Shifting Shifting Shifting Shifting Shifting Shifting Shifting Shifting 10 gives: wjmunhxh9dq8yngDynxna Shifting 11 gives: xknvoiyi:er9zohEzoyob Shifting 12 gives: ylowpjzj;fs:apiFapzpc Your output Shifting 13 gives: zmpxgkak<gt;bgjGbgagd Shifting 14 gives: anqyrlbl=hu<crkHcrbre Shifting 15 gives: borzsmcm>iv=dslIdscsf Shifting 16 gives: cpsatndn?jw>etmJetdtg Shifting 17 gives: dqtbuoeo@kx?funKfueuh Shifting 18 gives: erucvpfpAly@gvoLgvfvi Shifting 19 gives: fsvdwąggBmzAhwpMhwgwj Shifting 20 gives: gtwexrhrCnaBixqNixhxk Shifting 21 gives: huxfysisDobcjyrojyiyl Shifting 22 gives: ivygztjtEpcDkzsPkzjzm Shifting 23 gives: jwzhaukuFqdElatQlakan Shifting 24 gives: kxaibvlvGreFmbuRmblbo Shifting 25 gives: lybjCwmwHsfGncvSncmcp Enter some lower-case text: Shifting O gives: mzckdxnx/tg.odw:odndg Shifting 1 gives: nadleyov/uh.pex:peoer 2 gives: obemfzpz/vi.gfy:gfpfs 3 gives: pcfngaqa/wj.rgz:rgggt 4 gives: qdgohbrb/xk.sha:shrhu 5 gives: rehpicsc/yl.tib:tisiv 6 gives: sfiqjdtd/zm.ujc:ujtjw 7 gives: tgjrkeue/an.vkd: vkukx 8 gives: uhkslfvf/bo.wle:wlvly 9 gives: viltmgwg/cp.xmf: xmwmz Shifting 10 gives: wjmunhxh/dg. yng: ynxna Shifting Shifting Shifting Shifting Shifting Shifting Shifting Shifting Shifting 11 gives: xknvoiyi/er.zoh:zoyob Shifting 12 gives: ylowpjzj/fs.api:apzpc Expected output Shifting 13 gives: zmpxqkak/gt.bqj:bgagd Shifting 14 gives: angyrlbl/hu.crk:crbre Shifting 15 gives: borzsmcm/iv.dsl:dscsf Shifting 16 gives: cpsatndn/jw.etm:etdtg Shifting 17 gives: dqtbuoeo/kx.fun: fueuh Shifting 18 gives: erucvpfp/ly.gvo:gvívi Shifting 19 gives: fsvdwggg/mz.hwp:hwgwj Shifting 20 gives: gtwexrhr/na.ixg:ixhxk Shifting 21 gives: huxfysis/ob.jyr:jyiyl Shifting 22 gives: ivygztjt/pc.kzs:kzjzm Shifting 23 gives: jwzhauku/gd.lat:lakan Shifting 24 gives: kxaibvlv/re.mbu:mblbo Shifting 25 gives: lybjcwmw/sf.ncv:ncmcp 3: Hidden Check a
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education