Question: I dont know what I am doing wrong... it keeps saying that it is skipping things when i run the debug... I am working on
I dont know what I am doing wrong... it keeps saying that it is skipping things when i run the debug... I am working on creating classes and then impliminting them in the main
here is the code I have so far...
int main
int choice ;
string input;
int offsetInput;
string encoded;
string decoded;
do
cout Set offset
Encode a message
Decode a message
Exit
endl;
cin choice;
switch choice
case :
cout "What offset? ;
cin offsetInput;
TextCodecoffsetInput;
break;
case :
cout "What message? ;
getlinecin input;
TextCodec codec;
encoded codec.Encodeinput;
cout encoded endl;
break;
case :
cout "What message? ;
cin.ignore;
getlinecin input;
TextCodec codec;
decoded codec.Decodeinput;
cout decoded endl;
break;
case :
cout "Thanks for playing";
break;
while choice;
;
class TextCodec
attributes
short int offset;
public:
default constructor
TextCodec
SetOffset;
overload constructor
TextCodecshort int offset
SetOffsetoffset;
void SetOffsetshort int offset
thisoffset offset;
encode method
string Encodestring message
std::string result message;
for int i ; i message.length; i
resulticharresulti offset;
return result;
decode method
string Decodestring message
std::string result message;
for int i ; i message.length; i
resulticharresulti offset;
return result;
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
