Project Description Create a C++ application that converts a text file into a format more appropriate for use in a webpa

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Project Description Create a C++ application that converts a text file into a format more appropriate for use in a webpa

Post by answerhappygod »

Project Description Create A C Application That Converts A Text File Into A Format More Appropriate For Use In A Webpa 1
Project Description Create A C Application That Converts A Text File Into A Format More Appropriate For Use In A Webpa 1 (111.54 KiB) Viewed 35 times
Project Description Create a C++ application that converts a text file into a format more appropriate for use in a webpage, smart- phone, or e-book reader. Specifically, this program converts an ASCII text file to an HTML file containing the same textual content as the original ASCII text file. Conversion Rules The HTML file will have the following structure: Element Example Document type tag <!DOCTYPE html> HTML document start tag <html> HTML header start tag <head> HTML title tag <title> text </title> Page title is derived from the filename of ASCII text file story.txt → <title>story</title> without the header HTML head end tag </head> HTML body start tag <body> Definition: Paragraphs are non-empty lines followed by two consecutive newline characters. Paragraphs formatted with <br>. First Line First Line Second Line Second Line Lines of text are reproduced and terminated with <br> Third Line Third Line <br> Paragraphs formatted with <p>. First Line <p> Second Line First Line Paragraph begins with <p>, lines of text are reproduced Third Line Second Line and terminated with </p> Third Line </p> Additional blank lines are replaced with <br> Formatted with <br> Note: there will be as many <br> between the One One paragraphs as there are newlines. <br> <br> Two ... <br> Two ... Formatted with <p> Note: there will be one </p> for the first two newlines One One following a paragraph and one <br> for each addition newline before the next paragraph. Two ... <p> </p> <br> Two ...
The executable file must be named: txt2html.exe The program will operate as a command-line utility (not a console input program). An Example: c:> txt2html Story.txt Story.html This example uses <br> line-break tags. Below is an ASCII text file named "Story.txt" converted to "Story.html". Note that represents an <Enter> in the text. Story.txt Are These Aliens Martians? اله an adaptation J The men from Earth stared at the aliens. The little green men had pointed heads and orange toes with one long curly hair on each tee. - اله 2. G. Wells' novel The War of the Worlds (1898) has had an extraordinary influence on science fiction. - Wells' Martians are a technologically advanced species. with an ancient civilization. They somewhat resemble cephalopods, with large, bulky brown bodies and sixteen snake-like tentacles, in two groups of eight, around a quivering V-shaped mouth; they move around in 100 feet tall tripod fighting-machines they assemble upon landing, killing everything in their peth. Story.html <!DOCTYPE html> <html> <head> <title>Story</title> </head> <body> Are These Aliens Martians? <br> <br> <br> an adaptation <br> <br> The men from Earth stared at the aliens. The little green men had pointed heads and orange toes with one long curly hair on each toe. <br> <br> H. G. Wells' novel The War of the Worlds (1898) has had an extraordinary influence on science fiction. Welis' Martians are a technologically advanced species with an ancient civilization. They somewhat resemble cephalopods, with large, bulky brown bodies and sixteen snake-like tentacles, in two groups of eight, around a quivering V-shaped mouth; they move around in 100 feet tall tripod fighting-machines they assemble upon landing, killing everything in their path. <br> <br> <br> <br> by your name <br> <br> </body> </html> by your name Another Example: c:\> txt2html -p Story.txt Story.html This example uses <p> paragraph tags. Below is an ASCII text file named "Story.txt" converted to "Story.html". Note that represents an <Enter> in the text. Story.txt Are These Aliens Martians? an adaptation The men from Earth stered at the aliens. The little green men had pointed heads and orange toes with one long curly hair on each toe. Story.html <!DOCTYPE html> <html> <head> <title>Story</title> </head> <body> <p> Are These Aliens Martians? </p> <br> <p> an adaptation </p> <p> The men from Earth stared at the aliens. The little green men had pointed heads and orange toes with one long curly hair on each toe. H. G. Wells' novel The War of the Worlds (1898) has had an extraordinary influence on science fiction. - Wells' Martians are a technologically advanced species with an ancient civilization. They somewhat resemble cephalopods, with large, bulky brown bodies and sixteen snake-like tentacles, in two groups of eight,
</p> around a quivering V-shaped mouth; they move around in 100 feet tall tripod fighting-machines they assemble upon landing, killing everything in their path. by your name <p> H. G. Wells' novel The War of the Worlds (1898) has had an extraordinary influence on science fiction. Wells' Martians are a technologically advanced species with an ancient civilization. They somewhat resemble cephalopads, with large, bulky brown bodies and sixteen snake-like tentacles, in two groups of eight, around a quivering V-shaped mouth; they move around in 100 feet tall tripod fighting-machines they assemble upon landing, killing everything in their path. </p> <br> <br> <p> by your name </p> </body> </html> -r Program Interface txt2html [--help] [-rp] textfilename [htmlfilename] --help display the help text for the program. report conversion metrics use <p> tag for paragraph breaks text Filename the name of the ASCII text file to process htmlFilename the name of the HTML file receiving the output. If not provided the text filename will be used with its extension changed to ".html" -p Notes 1. If the help switch is found all other command line arguments are ignored. 2. The 'r' and 'p' switches can be used individually, or together, and in any order. 3. The 'r' switch will report: # lines input # paragraphs output 4. The text filename must be present and can have any file extension (not just .txt). 5. The html filename is optional. If present, it can have any file extension (not just.html). If absent, it will have the same stem as the text filename, but the extension.html. It is an error if both files have the same name. 6. Do not hardcode or limit the filenames in any way! Do not require txt or .html extensions on the name. Do not limit, change, or prevent a path prefix to either filename. Command-line Examples txt2html Story.txt txt2html -p Story.txt txt2html -r \usr\Story.txt txt2html -pr Story.txt txt2html -rp Story.txt txt2html Story.txt Story.html txt2html -p Story.txt \usr\NewStory.html txt2html -r Story.txt Other.txt
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply