Ok, scratched some things out... this is by no means complete, nor is it the prettiest or OO way to do things...
main.cpp
Code:
#include <iostream>
#include <fstream>
#include <string>
using std::cout;
using std::endl;
using std::string;
using std::ofstream;
void writeHeader(string title, string cssFile, ofstream &htmlFile);
void writeDiv(string divClass, string contents, ofstream &htmlFile);
void writeFooter(ofstream &htmlFile);
int main(int argc, char *argv[])
{
cout<<"HTML Writter, lets see how well this works!"<<endl;
ofstream htmlFile;
htmlFile.open("index.html");
writeHeader("Test","standard.css", htmlFile);
htmlFile << "Here is some text not inside of div tags\n";
writeDiv("blueText","Here is some text inside of div class blueText",htmlFile);
writeFooter(htmlFile);
return 0;
}
void writeHeader(string title, string cssFile, ofstream &htmlFile) {
htmlFile << "<html>\n<head>\n<title>" << title << "</title>\n"
<< "<link rel=\"StyleSheet\" href=\"" << cssFile << "\" type=\"text/css\">\n"
<< "<body>\n";
}
void writeDiv(string divClass, string contents, ofstream &htmlFile) {
htmlFile << "<div class=\"" << divClass << "\">" << contents << "</div>\n";
}
void writeFooter(ofstream &htmlFile) {
htmlFile << "</body>\n</html>\n";
}
standard.css
Code:
body {
color: red;
background: black;
}
.blueText {
color: blue;
}
This should be a decent starter and show you a little about div/css stuff, not much but I was bored and this sounded like something I wanted to write out.