Please help me to answer the Q 4 Write a C program named a4q

Please help me to answer the Q 4) Write a C program named a4q4.c which reads the standard input and extract HTML-style tags from it. We consider that the HTML-style tags are all strings starting with character “less-than” (<) and end with the character “greater-than” (>). In case that there is a tag starting with ‘<’ but not finishing with ‘>’ at all, then print it all the way to the end of input. Each tag should start at a new line. Input The input is in a free textual form. Output The output consists of a list of tags in the order that they appear in text. Each tag should start on a new line. All content of a tag should be printed in the same way as it appears in input. If a tag is not finished, it should still be printed. The sample input and output below illustrate behaviour of the program. Hint : The program should read input character by character and immediatelly produce output or not based on the context.

Sample Input: This is sample intermediate text tag> and another example character may appear outside of a tag. and also

Solution

void remove_html(char* str) { char* html_str = str; while(*str) { if(*html_str == \'<\') while(*html_str && *html_str++ != \'>\'); *str++ = *html_str++; } } int main() { char foo[] = \"hello

friends!

\"; remove_html(foo); puts(foo); }
Please help me to answer the Q 4) Write a C program named a4q4.c which reads the standard input and extract HTML-style tags from it. We consider that the HTML-s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site