Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there! I have this following C++ code and I am using a Mac. How do I fix these errors shown with red in the

Hi there! I have this following C++ code and I am using a Mac. How do I fix these errors shown with red in the image below?

#include

#include

#include

using namespace std;

int main() {

string key;

string text;

cout ​`oaicite:{"index":0,"invalid_reason":"Malformed citation >"}`​ key;

if (key.length() != 26) {

cout

return EXIT_FAILURE;

}

for (int i = 0; i

if (!isalpha(key[i]) || !islower(key[i])) {

cout

return EXIT_FAILURE;

}

}

bool alphabet[26] = { false };

for (int i = 0; i

alphabet[key[i] - 'a'] = true;

}

for (int i = 0; i

if (!alphabet[i]) {

cout

return EXIT_FAILURE;

}

}

cout ​`oaicite:{"index":1,"invalid_reason":"Malformed citation >"}`​ text;

for (int i = 0; i

if (!isalpha(text[i]) || !islower(text[i])) {

cout

return EXIT_FAILURE;

}

}

for (int i = 0; i

text[i] = key[text[i] - 'a'];

}

cout

return EXIT_SUCCESS;

}

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+Is the sex relevant to the issue?

Answered: 1 week ago

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago