
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Can you please help me do this C++ program, its for a class called Object Oriented

Transcribed Image Text:Program 2: Text converter
Create a program that reads an HTML file and converts it to plain text.
Console
HTML Converter
Grocery List
* Eggs
* Milk
* Butter
Specifications
The input file in.html may contain these HTML tags:
<h1>Grocery
List</h1>
<ul>
<li>Eggs</li>
<li>Milk</li>
<li>Butter</li>
</ul>
When the program starts, it should read the contents of the file, remove the HTML
tags, remove any spaces to the left of the tags, add asterisks (*) before the list items,
and display the content and the HTML tags on the console as shown above.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Thanks for the code, can you help me fix this two errors, i dont know how to do it.
![<
main.cpp
1 #include <iostream>
2 #include <fstream>
3 #include <regex> //include regex library for pattern matching
4 using namespace std;
5
6 - int main() {
7 string filename "groceries.html";
8 ifstream infile(filename); //open file
9 string line;
10
11
while (getline(infile, line)) { //read file line by Line
regex tag_regex("<[^>]>"); //create regex pattern for html tags
tag_regex, ""); //remove html tags
line =
regex_replace(line,
regex_replace(line, regex("^\s+"), ""); //remove Leading spaces
12
13 line
14- if (line != "") { //if Line is not empty
15 if (line[0] == '') { //if line starts with an asterisk
16 cout << line << endl; //print line as is
17- } else {
18 cout << "* " << line << endl; //add an asterisk at the beginning and print Line
19 }
20 }
21 }
22
23
return 0;
input
Compilation failed due to following error(s).
main.cpp:15:16: error: empty character constant
15 | if (line[0] == '') { //if line starts with an asterisk
|
AN
main.cpp: In function 'int main()':
main.cpp:13:34: warning: unknown escape sequence: '\s'
13 | line = regex_replace(line, regex("^\s+"), ""); //remove leading spaces
|
ANNNNN](https://content.bartleby.com/qna-images/question/549651ba-b33d-474d-abf4-48863f7a8bc4/dfa5e5cf-0dea-4b23-99a2-0228a74896af/inuiao8_thumbnail.png)
Transcribed Image Text:<
main.cpp
1 #include <iostream>
2 #include <fstream>
3 #include <regex> //include regex library for pattern matching
4 using namespace std;
5
6 - int main() {
7 string filename "groceries.html";
8 ifstream infile(filename); //open file
9 string line;
10
11
while (getline(infile, line)) { //read file line by Line
regex tag_regex("<[^>]>"); //create regex pattern for html tags
tag_regex, ""); //remove html tags
line =
regex_replace(line,
regex_replace(line, regex("^\s+"), ""); //remove Leading spaces
12
13 line
14- if (line != "") { //if Line is not empty
15 if (line[0] == '') { //if line starts with an asterisk
16 cout << line << endl; //print line as is
17- } else {
18 cout << "* " << line << endl; //add an asterisk at the beginning and print Line
19 }
20 }
21 }
22
23
return 0;
input
Compilation failed due to following error(s).
main.cpp:15:16: error: empty character constant
15 | if (line[0] == '') { //if line starts with an asterisk
|
AN
main.cpp: In function 'int main()':
main.cpp:13:34: warning: unknown escape sequence: '\s'
13 | line = regex_replace(line, regex("^\s+"), ""); //remove leading spaces
|
ANNNNN
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Thanks for the code, can you help me fix this two errors, i dont know how to do it.
![<
main.cpp
1 #include <iostream>
2 #include <fstream>
3 #include <regex> //include regex library for pattern matching
4 using namespace std;
5
6 - int main() {
7 string filename "groceries.html";
8 ifstream infile(filename); //open file
9 string line;
10
11
while (getline(infile, line)) { //read file line by Line
regex tag_regex("<[^>]>"); //create regex pattern for html tags
tag_regex, ""); //remove html tags
line =
regex_replace(line,
regex_replace(line, regex("^\s+"), ""); //remove Leading spaces
12
13 line
14- if (line != "") { //if Line is not empty
15 if (line[0] == '') { //if line starts with an asterisk
16 cout << line << endl; //print line as is
17- } else {
18 cout << "* " << line << endl; //add an asterisk at the beginning and print Line
19 }
20 }
21 }
22
23
return 0;
input
Compilation failed due to following error(s).
main.cpp:15:16: error: empty character constant
15 | if (line[0] == '') { //if line starts with an asterisk
|
AN
main.cpp: In function 'int main()':
main.cpp:13:34: warning: unknown escape sequence: '\s'
13 | line = regex_replace(line, regex("^\s+"), ""); //remove leading spaces
|
ANNNNN](https://content.bartleby.com/qna-images/question/549651ba-b33d-474d-abf4-48863f7a8bc4/dfa5e5cf-0dea-4b23-99a2-0228a74896af/inuiao8_thumbnail.png)
Transcribed Image Text:<
main.cpp
1 #include <iostream>
2 #include <fstream>
3 #include <regex> //include regex library for pattern matching
4 using namespace std;
5
6 - int main() {
7 string filename "groceries.html";
8 ifstream infile(filename); //open file
9 string line;
10
11
while (getline(infile, line)) { //read file line by Line
regex tag_regex("<[^>]>"); //create regex pattern for html tags
tag_regex, ""); //remove html tags
line =
regex_replace(line,
regex_replace(line, regex("^\s+"), ""); //remove Leading spaces
12
13 line
14- if (line != "") { //if Line is not empty
15 if (line[0] == '') { //if line starts with an asterisk
16 cout << line << endl; //print line as is
17- } else {
18 cout << "* " << line << endl; //add an asterisk at the beginning and print Line
19 }
20 }
21 }
22
23
return 0;
input
Compilation failed due to following error(s).
main.cpp:15:16: error: empty character constant
15 | if (line[0] == '') { //if line starts with an asterisk
|
AN
main.cpp: In function 'int main()':
main.cpp:13:34: warning: unknown escape sequence: '\s'
13 | line = regex_replace(line, regex("^\s+"), ""); //remove leading spaces
|
ANNNNN
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- I’m trying to figure out this Computer Science (C++) assignment. It’s about Classes. It must utilize 1-2 .cpp files and 1 .h file.arrow_forwardwrite a code with c++ add a little animation if you want saying "you're one of a kind" just be creativearrow_forwardWrite a C++ program that will use good object-oriented principles.You have been tasked to write an application that will allow a user to change their system password. The XYZ Corporation has the following rules for passwords: each password should have a minimum of 8 characters each password should have a minimum of 2 uppercase characters (A - Z) each password should have a minimum of 2 lowercase characters (a - z) each password should have a minimum of 2 digits (0 - 9) each password should have a minimum of 2 special characters of which the following characters are allowed: !, @, $, %, and & (in any combination) Once the user has created a new password that passes the above requirements, the user must then retype the password for the program to verify that the same password was entered by the user. If the user creates a password that does not meet the minimum requirements, be sure to let the user know the entered password does not meet the minimum requirements and allow the…arrow_forward
- DO NOT COPY FROM OTHER WEBSITES Write your own answer. Thank you!arrow_forwardWhat what separates a method from a function called Object() in native code, and how do they work differently from one another?arrow_forwarda small code Program C++ sorting the employees rate of pay from high to low something with good amount of linesarrow_forward
- Should the large software be divided into smaller modules, with each module responsible for a certain task? These sections are known as functions in the C++ programming language. Do you have anything else to add to this?arrow_forwardImplement a C++ program for a RESTAURANT that has multiple branches, and each branch has menus of food items, their stock and a list of customers. A branch may have for example a breakfast menu and lunch menu with different food items, and the stock (available quantity) of each food item in the branch. Also, the branch will have a list of regular customers and their contact information to contact them for offers and new food items. Class Names Data and Member Functions Food Data Members: ID, Name, Calories, Price Member Functions: getID, getName, getCalories, getPrice setID, setName, setCalories, setPrice Stock Data Members: ID, Food, Stock Member Functions: getID, getFood, getStock setID, setFood, setStock Customer Data Members: ID, Name, Phone Member Functions: getID, getName, getPhone setID, setName, setPhoe Menu Data Members: ID, Name, foodList Member Functions: getID, getName, getFoodList setID, setName Branch Data Members: ID, Address, menuList, stockList, customerList Member…arrow_forwardYou are expected to use python Object-Oriented programming concepts to design and implement a system in python for building a scientific calculator which inherits its basic operations from a standard calculator. The standard calculator can perform two types of operations: an addition and a subtraction The standard calculator is capable of inputting only two integers. But the scientific calculators can also interpret decimal values. The scientific calculator is capable of four operations: addition, subtraction, cosine and sine of values. The scientific calculator can accept multiple values for the addition operation. After performing an addition, the scientific calculator will send the final result to a database. (You are not expected to write the codes for the database connection and the queries. You are expected to only show how you can use your scientific calculator object to pass messages to a database object) Create 100 objects for your scientific calculator to enable…arrow_forward
- In the class diagram below we have a parking charge class for an object-oriented parking system that is to be designed using java. Briefly explain any implementation decisions and the reasoning behind those without writing the complete code. N.B explain how the implementation will proceed instead of writing codearrow_forwardLanguage is C++ Lab14A: The Architect. Buildings can be built in many ways. Usually, the architect of the building draws up maps and schematics of a building specifying the building’s characteristics such as how tall it is, how many stories it has etc. Then the actual building itself is built based on the schematics (also known as blueprints). Now it is safe to assume that the actual building is based off the blueprint but is not the blueprint itself and vice versa. The idea of a classes and objects follows a similar ideology. The class file can be considered the blueprint and the object is the building following the analogy mentioned above. The class file contains the details of the object i.e., the object’s attributes (variables) and behavior (methods). Please keep in mind that a class is a template of an eventual object. Although the class has variables, these variables lack an assigned value since each object will have a unique value for that variable. Think of a form that you…arrow_forwardIs there a difference between static and dynamic type checking?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education