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, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
question
Computers and Technology, 24.06.2019 00:00
Afashion designer wants to increase awareness about her brand. which network can she use and why she can use the blank to blank her products online. answers for the first blank: internet, extranet, or intranet answers for the second blank: market, design, and export
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, 12.08.2020 07:01
question
Mathematics, 12.08.2020 07:01
question
Mathematics, 12.08.2020 07:01
question
English, 12.08.2020 07:01
Questions on the website: 13722367