$34.99
Assignment - Write a program that:
1) reads in a C++ source file (.cpp) 2) converts all < symbols to < 3) converts all > symbols to > 4) add the
and
tags to the front and end of the file 5) output the modified file to disk as an html file
Have a look here for escape sequences in HTML:
http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C47007456E7
To avoid this problem, HTML uses special symbols to denote < and >. The < symbol is created with the string < while the > symbol is created with the string >.
Write a program that reads a C++ source file and converts all < symbols to < and all > symbols to >. Also add the tag to the beginning of the file and
to the end of the file. This tag preserves whitespace and formatting in the HTML document. Your program should output the HTML file to a disk.
As an example, given the following input file:
```
include
int main() { int x=4; if (x < 3) x++; cout << x << endl; } ``` the program should produce a text file with the following contents: ```
include <iostream>
int main() { int x=4; if(x < 3) x++; cout << x << endl;
}
```
You can test your output file by opening it with a web browser. The contents should appear identical to the original source code.
David Russell
Assignment Source – Modified from Savitch Absolute C++