Lindsey
2012-02-19 20:41:09 UTC
My assignment is ask a user to input a file, these files contain old HTML codes. The programs job is to fix these old html codes into newer versions and output it into a new file. We only have to edit certain codes (that are listed below). I also need to count how many times the program corrects something, and give the final answer of fixes at the end.
"Has a function with input and output streams as arguments to do the corrections by adding " /" (space+slash) right before the ">" in the following tags:
should become
should become
should become
should become
Note that it is possible for the input file to have many of each type of these old style html tags, and they can appear in no particular order.
Note also that some of these tags have a large amount of "stuff" called attributes which you need to leave alone... you will just need to find the next ">".
Note that you may assume that the "<" followed by two matching characters uniquely identifies the tag. In other words, if you find
; and if you find
;
You MAY also assume that none of these four specific tags have already been updated in the file, so you do not need to worry about checking to see if there is already a " /" before the ">" of these tags; however, note that you cannot just put a " /" before EVERY ">" in the whole document because that will make the html page completely fail. Thus, the " />" should be added ONLY at the end of the specific tags: , ,
, and
."
My question is, how do I search for these corrections within an input file? I really don't know how to begin other than opening up the file in the program. Once again, thank you.