Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to return the decrypted message and pass it into a print function. I don't know what the error is. Please help! Header

I am trying to return the decrypted message and pass it into a print function.

I don't know what the error is. Please help!

Header & respective functions:

class Decoder { private: char *encrypted; bool status; int size; char message[];

public: Decoder(string file, int maxBytes); bool getStatus(); char decrypt(); void print(); };

char Decoder::decrypt() { char key[] = { 'i','z','t','o','h','n','d','b','e','q','r','k','g','l','m','a','c','s','v','w','f','u','y','p','j','x' }; if (getStatus()) { char message[]; for (int i = 0; i < size; i++) { message[i] = key[(int)encrypted[i] - 97]; } } else { cout << "Message not decrypted." << endl; }

return message; }

void Decoder::print() { cout << "Decrypted message: " << decrypt() << endl; }

int main() { Decoder obj("encrypted.txt", 26); obj.decrypt(); obj.print(); return 0; }

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

Students also viewed these Databases questions

Question

7. Determine what feedback is provided to employees.

Answered: 1 week ago