1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#include <iostream>
#include <string>
FILE *index;
FILE *stylesheet;
FILE *headone;
using namespace std;
void autoHead();
void autoBody();
void autoSchemata();
void embeddedCSS();
void externalCSS();
string nameFunction();
int main(void){
string choice;
string name;
cout << "Welcome child, you have entered my domain," << endl <<
"my name is Tyrant, King of HTML. I would assume you have traveled here" << endl <<
"to seek my service, would this be the case? (yes/no):\t" << endl << endl;
getline(cin, choice);
if (choice == "yes") {
name = nameFunction();
}
else {
exit(1);
}
cout << "Pleasure to be of service " << name << " Let's start guiding you throught the process!" << endl << endl;
cin.get();
index = fopen("index.html", "w");
cout << "Your HTML Document has been initialized, the style type is embedded." << endl;
autoHead();
autoBody();
fclose(index);
return 0;
}
string nameFunction(){
string name;
cout << "Understand that I am a busy Tyrant," << endl <<
"and so in order to comply with your wishes I can ill afford to be" << endl <<
"tied up in the land of mundane beyond my steely flesh; thus," << endl << endl <<
"By signing any name below, you agree that you will not pursue me" << endl <<
"for any legal concerns." << endl << endl <<
"Please sign your name Below" << endl << endl;
getline(cin, name);
cout << endl;
return name;
}
void autoHead(){
string titleHTML;
char c;
if (!(headone = fopen("headone.txt", "r"))){
printf("Program cannot function, you've deleted headone.txt");
exit(1);
}
while ((c = getc(headone)) != EOF){
putc(c, index);
}
fclose(headone);
cout << "It is necessary that I collect information pertaining to your page." << endl <<
"Type what should appear in the browsers title bar:\t";
getline(cin, titleHTML);
fprintf(index, "<title>%s</title>\n", titleHTML);
fprintf(index, "<meta charset=\"utf-8\">\n");
autoSchemata();
fprintf(index, "<style>\n");
fprintf(index, "body {\n");
fprintf(index, "background-color: #FF0066;\n");
fprintf(index, "color: #FFFFFF;\n");
fprintf(index, "}\n");
fprintf(index, "</style>\n");
fprintf(index, "</head>\n\n");
}
void autoBody(){
fprintf(index, "<body>\n");
fprintf(index, "<div>\n");
fprintf(index, "This program is incomplete\n");
fprintf(index, "</div>\n");
fprintf(index, "</body>");
fprintf(index, "</html>");
}
void autoSchemata(){
string choice;
cout << "It is necessary to know whether I should create an embedded or" << endl <<
"an external CSS. Please choose either (embedded/external):\t";
cin >> choice;
if (choice == "embedded"){
embeddedCSS();
}
else if (choice == "external"){
externalCSS();
}
else{
cout << "Invalid Selection.";
}
}
void embeddedCSS(){
}
void externalCSS(){
fclose(index);
stylesheet = fopen("stylesheet.css", "w");
}
|