subject

In this lab, you will write a C++ program for extracting the text from a webpage. You should implement 4 functions, described below. Your code should follow C++ conventions, and it should not use any libraries other than those we have discussed in class so far. You should submit your code as a single. cpp source file, and your code should be able to be compiled with g++. • string readFile(string filename) • This function opens the file with the given name, reads in the entirety of the file, and returns a string containing the file contents. It should return the empty string if the file doesn't exist string extractParagraphs(string content) This function should return all of the paragraph contents in the given HTML content, and each paragraph should be followed by two new lines (\n\n). Paragraphs in HTML start with a paragraph start tag () and end with a paragraph end tag ( ), and the contents are between these two tags. The output should not include any of the start or end tags. string remove Tags(string content) This function should search the given HTML content and remove all of the HTML tags. All HTML tags start with a less than sign (<) and end with a greater than sign (>), and anything that begins with a less than sign and ends with a greater than sign is an HTML tag. • int main() o main() should use the other 3 functions to read in the contents of input. html, extract all of the paragraphs in this file, remove the tags from the paragraphs, and print the result to cout. Recommendations First, start with a main function that calls all 3 of the other functions and just "stub out" the other 3 function. "Stubbing out" a function (or "writing a function stub") involves writing the function prototype with an empty or 1-line body that mostly exists so that the source code can compile (empty body for void functions, and a 1-line return statement for other functions). In this case, all 3 functions should just return their argument. Then, implement each function one at a time (readFile, then extractParagraphs, then remove Tags), and test the output of each function before starting on the next one. I've provided you three sample input files, as well as the correct output after extracting the paragraphs and removing the HTML tags. Samolennu fler

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
By refraining from constructing a building until they are certain that it will not cause harm to the environment, an organization is adhering to the
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
question
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
question
Computers and Technology, 24.06.2019 08:00
Arah has entered data about football players from team a and team b in a worksheet. she enters names of players from team a with details about each player in different columns of the worksheet. similarly, she enters details of all the players from team b. which option will her view the data for team a and team b in two separate sections after printing? a. page break view b. freeze pane view c. split screen view d. full screen view e. zoom out view
Answers: 1
You know the right answer?
In this lab, you will write a C++ program for extracting the text from a webpage. You should impleme...
Questions
question
Mathematics, 07.07.2021 02:00
question
Mathematics, 07.07.2021 02:00
question
Chemistry, 07.07.2021 02:00
question
Mathematics, 07.07.2021 02:00
question
Mathematics, 07.07.2021 02:00
question
English, 07.07.2021 02:00
question
Mathematics, 07.07.2021 02:10
question
Mathematics, 07.07.2021 02:10
question
Mathematics, 07.07.2021 02:10
Questions on the website: 13722359