Could you help me write a C++ Program to do the following: This is to create a prototype for a Web browser. You’ll do this by transforming the file viewer we created in class into a browser for a web of files that are all located on a single computer. (This is in contrast to the real World Wide Web whose pages are located all over the world.) Details The files in this web of files are plain text files that may contain anchors that provide links to other files. More precisely, an anchor is a string of the form 1 where filename is the name of another file and text is a piece of text. For example, here’s a line of text that contains an anchor: More is available. To keep things simple, assume that every anchor is separated from adjacent text by white space and that the strings filename and text cannot contain white space. Your browser should work exactly like the file viewer, except for the following: The browser should have a new command called go. This command asks the user for a number and then opens the file associated with the corresponding anchor: command: g link number: 5 2 this should cause the file info.txt to be displayed. The browser should have another new command called back that reopens the previous file. This requires the browser to keep a record of the files that have been visited. For example, if the user visits files A, B and then C, the back command would return to B. But note that using the back command again would go to A, not back to C. In other words, files should get added to the “history” only when they are visited by following a link (with the go command) or by using the open command, not by using the back command. The browser should format the contents of each file as follows. Each file is assumed to consist of a sequence of “words” separated by white space. Note that, in this context, a word may include punctuation. For example, the following line contains six words: Each component performs one well−defined task. When a file is displayed, all the words should be separated by a single blank space and arranged so that the lines are as long as possible but no longer than a maximum length specified by the user. If ever a word is longer than that length, it should be displayed on a line by itself. The program should ask the user for the maximum line length right after it asks for the window height. The maximum line length should be a number of characters, not words. Besides anchors, files can contain two other elements that affect how the text is displayed. The line-break element, written, causes a new line to begin immediately, even if the maximum line length hasn’t been 3 reached. The new-paragraph element, written, causes a new paragraph to be started. When displayed, consecutive paragraphs should be separated by a single blank line. Blank lines in the input file should be ignored. To keep things simple, assume that the and elements are separated from surrounding text by white space.
Could you help me write a C++ Program to do the following:
This is to create a prototype for a Web browser. You’ll do this by transforming the file viewer we created in class into a browser for a web of files that are all located on a single computer. (This is in contrast to the real World Wide Web whose pages are located all over the world.) Details The files in this web of files are plain text files that may contain anchors that provide links to other files. More precisely, an anchor is a string of the form 1 where filename is the name of another file and text is a piece of text. For example, here’s a line of text that contains an anchor: More is available. To keep things simple, assume that every anchor is separated from adjacent text by white space and that the strings filename and text cannot contain white space. Your browser should work exactly like the file viewer, except for the following:
The browser should have a new command called go. This command asks the user for a number and then opens the file associated with the corresponding anchor: command: g link number: 5 2 this should cause the file info.txt to be displayed. The browser should have another new command called back that reopens the previous file. This requires the browser to keep a record of the files that have been visited. For example, if the user visits files A, B and then C, the back command would return to B. But note that using the back command again would go to A, not back to C. In other words, files should get added to the “history” only when they are visited by following a link (with the go command) or by using the open command, not by using the back command. The browser should format the contents of each file as follows. Each file is assumed to consist of a sequence of “words” separated by white space. Note that, in this context, a word may include punctuation. For example, the following line contains six words: Each component performs one well−defined task. When a file is displayed, all the words should be separated by a single blank space and arranged so that the lines are as long as possible but no longer than a maximum length specified by the user. If ever a word is longer than that length, it should be displayed on a line by itself. The program should ask the user for the maximum line length right after it asks for the window height. The maximum line length should be a number of characters, not words. Besides anchors, files can contain two other elements that affect how the text is displayed. The line-break element, written, causes a new line to begin immediately, even if the maximum line length hasn’t been 3 reached. The new-paragraph element, written, causes a new paragraph to be started. When displayed, consecutive paragraphs should be separated by a single blank line. Blank lines in the input file should be ignored. To keep things simple, assume that the and elements are separated from surrounding text by white space.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
What would a brief design document look like for this code?