Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ HTML Encode Write a program that reads from stdin, prints to stdout, and encodes characters that have special meaning in an HTML file.

In C++

HTML Encode

Write a program that reads from stdin, prints to stdout, and encodes characters that have special meaning in an HTML file.

If a character in an input stream is one of the following five special characters, then it must be converted to an HTML-named entity as described in the following table.

Character HTML-encoding

& &

< <

> >

"

' '

For example, the following input stream:

This is a test file. All the special html characters should be escaped by the htmlencode application! These include the less-than, greater-than, quotes, and the ampersand: &<>"'
Another example: A more complex example... &&<<>>'''""" <&&'>&;"> < > > ' " & / +

File you must submit: htmlencode.cc

Hints: In order to read every character from std::cin without the spaces removed, you can prevent C++ from removing them by adding this line at the beginning of your program. std::cin >> std::noskipws;

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

draw appropriate conclusions based on your data.

Answered: 1 week ago