Please Help. Correct "Mark up Language" Tags.

Home Forums C Programming Please Help. Correct "Mark up Language" Tags.

Viewing 2 reply threads
  • Author
    • #2086

      I’m very new to “C” and am really struggling with an Assignment I have been set. I live in a very rural area and finding any help or extra Tutoring has been impossible, I have been recomended this Forum as I’m in serious danger of failing my entire Degree unless I can find some help.

      The Assignment is as follows.

      “A mark up language gives structure to a Document by using Tags. The Tags say what parts of the document are Titles, Headings, Bullet points etc. Every “on” Tag <...> (eg ) needs a closing “Off” Tag </.....>.</p> <p>Every “off” angle bracket </...> must pair a corresponding “on” bracket <...> that precedes it. At any place in our mark up language text we can either place an “on” Tag, or we can place the “Off” Tag corresponding to the last not yet paired on Tag. Every “on” Tag must be followed sooner or later by it’s corresponding “off” Tag.</p> <p>Write a C <a href="" target="_blank" rel="nofollow">Program</a> using only stdio.h library which diagnoses whether a text typed on one single line is correct in terms of tags or contains mistakes; In the later case the first mistake made in the typed text should be diagnosed. any Tag names are acceptable.”</p> <p>I’ve been told that I may need “push”, “Pop, and “Stack”?<br /> I’m not asking for the complete <a href="" target="_blank" rel="nofollow">Code</a>, I want to understand what has been written, and to submit my own work but I need Help. Any help, pointers or advice would really be appreciated a great deal.</p> <p>Thank you for your time.

    • #3371
      Priyansh Agrawal


      as I know, “push” and “pop” are assembler-commands.

      To solve this problem I recommend recursion.
      I don’t know if you know what this is, so I’ll explain it shortly:

      Recursion is when a function calls itself. So for each call in a call the local variables of the function are pushed on the stack. When the function ends, the variables are removed from the stack.

      So you could write a function which is called when the beginning-tag starts. And for each further beginning-tag it calls itself.

      In c you will need the string-functions in like strcmp, strncmp, … to compare the actual string-strip with “<" or "

    • #3372

      This is not a big problem. One way is suggested to use recursion. Another way is that you can make your own Stack.
      Push and pop are the operations of a Stack. When you insert a value in stack it is push and when you fetch the value from stack it is pop. the basic concept of a stack is First in Last out.
      Please don’t say that you can not make a program of these operation. If you are doing such programming then you must aware about stack.
      Another thing you would need is File handling in case you use real mark up files. For mark up language, You can see any web page. Basi markup language is HTML.
      Feel free to revert back if still has confusion.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.