Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:30, jcollings44
You picked the corridor which led you here. if the guards find you, they're going to be really angry! what is the synonym of angry
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, ansonhunter8891
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
image
Computers and Technology, 23.06.2019 10:30, badpotterchris
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
image
Computers and Technology, 23.06.2019 15:20, headshotplayzcod
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
Do you know the correct answer?
In this lab, you will write a C++ program for extracting the text from a webpage. You should impleme...

Questions in other subjects:

Konu
English, 10.01.2021 03:00
Konu
Chemistry, 10.01.2021 03:00