Question: Write c++ code. Include header files for defining classes: //Excecption.h #include using namespace std; class Exception { //data member protected: string error; public: //constructor Exception(const
Write c++ code. Include header files for defining classes:




//Excecption.h
#include
class Exception { //data member protected: string error; public: //constructor Exception(const string& message) { error=message; //set the message } //function getError string getError() { return error; //returns error message } };
//Cipher.h #include
using namespace std;
class Cipher { //abstract or pure virtual functions below public: virtual string encode(const string&)=0; virtual string decode(const string&)=0; };
//main.cpp
#include
using namespace std; /* The following main tests the functionality of various ciphers.
Use at your own discretion, and feel free to extend and/or modify in any way.
This file will be overwritten by the automarker if submitted. */
void testCipher(Cipher& cipher, const string& text) { try { string encoded = cipher.encode(text); cout
int main() { string shortText="Top Secret";
string longText="According to Larry Wall, the original author of the Perl programming language, there are three great virtues of a programmer; Laziness, Impatience, and Hubris. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hubris: The quality that makes you write (and maintain) programs that other people won't want to say bad things about."; OneTimePad pad(1); testCipher(pad, shortText); testCipher(pad, longText); try { pad.setSeed(-1); } catch(Exception e) { cout
try { pad.setSeed(9999); } catch(Exception e) { cout
OUTPUT
KtS8ePtFRa Top Secret
8hF(%OzBTl "M94(*_3|TbO#5FXwdF/_C#7ipYVeUg,!'yD=~Xb{REf#Kn::$l;}j5zGF7os^]K6vwMEoH:W{3 o7Ci43z(xx(q]IR*~=_pZvOqd&d7{VS2{K^qJj;aw/Z$kePT!MqC[X|{+tB-xxl,uzKciwQoM=UZ;uE]&Q{uSJ8}Mo\`Qi)Gt#Iz w%|`U|2ZG6q&.YyvjEm.FcMC09i According to Larry Wall, the original author of the Perl programming language, there are three great virtues of a programmer; Laziness, Impatience, and Hubris. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hubris: The quality that makes you write (and maintain) programs that other people won't want to say bad things about.
Negative number provided
i,bJ.MdxB) Top Secret
V U:MLjtD4.l"7:#2,RM=y#:&Ai3q*Op=9?->j2$/l5.ml2->!h@/9@P:Y>{j{.`_!-+=ZLEt&Ra-bB rD=M2tYK6't+:=E.|be;'de&-}rRxXP=*N0fjmMr@nIy.)4]"oK-gfe,Cnvo^X0!;j2S&hbuCWz{o.3FkBg7B,g[zxe3htgOZ$13EFCI$uh5{XRggm1KT7.6=>_L6V;L(f[9PP)$Skd&jQ|jFbL-wlGaOE?/6&^QNl> Ja1GcBbsGv^)s^+qk#5|^dB7/>'jtC0V9l^F(9dg;0~:+XY } 5:NPjg'& Top Secret js(*mOpc)1{fkoNiYLF The relationships between the classes are depicted in the UML below: Subseitutioncipher
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
