Question: We are using C++ for this. Example: I enter: Hello There Output to screen: Hello There There should not be any html tags in your

We are using C++ for this.

Example: I enter:

Hello

There

Output to screen: Hello There

There should not be any html tags in your output. The user is free to enter anything he/she wants, so it is not limited to the above example. So, your program needs to be able to remove any number of html tags entered.

Functions: I am expecting to see 3 functions in your program:

  1. Get the string value from the user via the keyboard
  2. Process the string value where you remove all html tags
  3. Output the updated string to the screen

This is my code I have so far, I am only able to get rid of the " tags. The "

are still there.

#include #include

using namespace std;

int main() { string name; cout << "Enter a textual value: "; // Enter your html tags here getline(cin, name);

int a = 0, b = 0;

for (int a = b; a < name.length(); a++) { if (name[a] == '<') { for (int b = a; b < name.length(); b++) { if (name[b] == '>') { name.erase(a, (b-a+1)); break; } } } }

cout << "Updated String Value: " << name << endl; // Will output what your new text will be

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!