Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program is in c++. Write a function named leetSpeak that accepts two string parameters representing an input and output file respectively. Your function should convert

Program is in c++. Write a function named leetSpeak that accepts two string parameters representing an input and output file respectively. Your function should convert the input file's text to "leet speak" (aka 1337 speak), an internet dialect where various letters are replaced by other letters/numbers, and output the "leet" version of the text to the given output file. Preserve the original line breaks from the input. Also wrap each word of input in parentheses. Perform the following replacements:

Original character 'Leet' character
o 0
l (lowercase L) 1
e 3
a 4
t 7
s (at the end of a word only) Z

For example, if the input file lincoln.txt contains the following text:

four score and seven years ago our fathers brought forth on this continent a new nation 

Then after a call of leetSpeak("lincoln.txt", "leet.txt");, the output file leet.txt should contain the following text:

(f0ur) (sc0r3) (4nd) (s3v3n) (y34rZ) (4g0) (0ur) (f47h3rZ) (br0ugh7) (f0r7h) (0n) (7hiZ) (c0n7in3n7) (4) (n3w) (n47i0n) 

You may assume that each token from the input file is separated by exactly one space.

Hint: You may want to use the Stanford C++ library's stringReplace function, which is used as follows:

string str = "mississippi";
str = stringReplace(str, "s", "*"); // str = "mi**i**ippi"

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions