1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergey [27]
3 years ago
13

This assignment requires you to write a program to analyze a web page HTML file. Your program will read one character at a time

from the file specifying the web page, count various attributes in the code for the page, and print a report to the console window giving information about the coding of the page.
Note that a search engine like Google uses at least one technique along similar lines. To calculate how popular (frequently visited or cited) a web page is, one technique is to look at as many other worldwide web pages as possible which are relevant, and count how many links the world's web pages contain back to the target page.
Learning Objectives
To utilize looping structures for the first time in a C++ program
To develop more sophisticated control structures using a combination of selection and looping
To read data from an input file
To gain more experience using manipulators to format output in C++
To consider examples of very simple hypertext markup language (HTML)
Use UNIX commands to obtain the text data files and be able to read from them
Problem Statement
Your program will analyze a few things about the way in which a web page is encoded. The program will ask the user for the name of a file containing a web page description. This input file must be stored in the correct folder with your program files, as discussed in class, and it must be encoded using hypertext markup language, or HTML. The analysis requires that you find the values of the following items for the page:
number of lines (every line ends with the EOLN marker; there will be an EOLN in front of the EOF)
number of tags (includes links and comments)
number of links
number of comments in the file
number of characters in the file (note that blanks and EOLNs do count)
number of characters inside tags
percentage of characters which occur inside tags, out of the total
Here is an example of a very simple HTML file:

Course Web Page
This course is about programming in C++.
Click here You may assume that the HTML files you must analyze use a very limited subset of basic HTML, which includes only the following "special" items: tag always starts with '<' and ends with > link always starts with " comment always starts with "" You may assume that a less-than symbol (<) ALWAYS indicates the start of a tag. A tag in HTML denotes an item that is not displayed on the web page, and often gives instructions to the web browser. For example, indicates that the next item is the overall title of the document, and indicates the end of that section. In tags, both upper and lowercase letters can be used. Note on links and comments: to identify a link, you may just look for an 'a' or 'A' which occurs just after a '<'. To identify a comment, you may just look for a '!' which follows just after a '' (that is, you do not have to check for the two hyphens). You may assume that these are the only HTML language elements you need to recognize, and that the HTML files you process contain absolutely no HTML syntax errors. Note: it is both good style because readability is increased, and convenient, to declare named constants for characters that are meaningful, for example const char TAG OPEN = ' Sample Input Files Program input is to be read from a text file. Your program must ask the user for interactive input of the file name. You can declare a variable to store the file name and read the user's response Miscellaneous Tips and Information You should not read the file more than once to perform the analysis. Reading the file more than once is very inefficient. The simplest, most reliable and consistent way to check for an end of file condition on a loop is by checking for the fail state, as shown in lectures. The eof function is not as reliable or consistent and is simply deemed "flaky" by many programmers as it can behave inconsistently for different input files and on different platforms. You may use only while loops on this project if you wish; you are not required to choose amongst while, do while and/or for loops until project 4 and all projects thereafter. Do not create any functions other than main() for this program. Do not use data structures such as arrays. You may only have ONE return statement and NO exit statements in your code. You may only use break statements inside a switch statement in the manner demonstrated in class; do not use break or continue statements inside loops. #include // used for interactive console I/O #include // used to format output #include // used to retrieve data from file #include // used to convert data to uppercase to simplify comparisons #include 11 for string class functions int main() { 1 //constants for analysing HTML attributes const char EOLN = '\n'; const char COMMENT_MARK = '!'; const char LINK='A'; //constants to format the output const int PAGEWIDTH = 70; const char UNDERLINE = '='; const char SPACE = const int PCT_WIDTH = 5; const int PCT_PRECISION = 2;
Computers and Technology
1 answer:
sattari [20]3 years ago
3 0

Answer:

bro it is a question what is this

Explanation:

please follow me

You might be interested in
Name and describe the two (2) broad categories of files
fenix001 [56]
If it’s computer files, that would be System Software and Application software.

“The System Software is the programs that allow the computer to function and access the functionality of the hardware. Systems software sole function is the control of the operation of the computer.

Applications software is the term used for programs that enable the user to achieve specific tasks such as create a document, use a database or produce a spreadsheet.”
8 0
3 years ago
There have not been any changes to instruments or music in the last 50 years. The technology in music is still the same.
aliya0001 [1]

Answer:

False i hope this is rigth

7 0
2 years ago
What is the value of |-10|
Goshia [24]
Its 10, value always has to be positive.
6 0
2 years ago
*asap* Name one of the similarities between Word and Excel.
Yakvenalex [24]
The similarities are:  in both programs you can type letters, insert images, hyperlinks.
7 0
2 years ago
What was the strategy the company adopted for ERP implementation?
SashulF [63]

Answer:

Big Bang or Phased Approach – ERP Implementation strategies include Big Bang, Phased, Hybrid, and Parallel Adoption. Each organization requirements are different and as such, the project management method is itself evolving using PPM, SCRUM, and DevOps.

8 0
2 years ago
Other questions:
  • Describe the indicators and hazards of a metal deck roof fire in an unprotected steel joist warehouse as well as the techniques
    6·1 answer
  • If you use a surrogate key, you must ensure that the candidate key of the entity in question performs properly through the use o
    5·1 answer
  • To execute a prepared SQL statement, you can use the ________________ and execute() methods of the PDOStatement object to set pa
    10·1 answer
  • What is not true about contracts?
    12·2 answers
  • What is the meaning of the word joystick
    6·2 answers
  • What is variable declaration in java ​
    6·2 answers
  • The natural language convention used to represent ip addresses is called the:
    15·1 answer
  • What system calls have to be executed by a command interpreter? Why is it usually separate from the kernel?
    12·1 answer
  • Identify the benefit of modeling to communicate a solution.
    10·1 answer
  • Can you anyone please help me​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!