In my crappy HTML editor (i emphasize crappy) every time it asks for you to imput a paragraph of information, it just skips it (ie.the program outputs "input paragraph...yadayadaya...but just skips it and goes onto the next thing. Here is my code:
Code:
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
void getFormat();
void menu();
void getPara();
int main()
{
remove("HTML Page.html");
cout << " ***********************************************\n";
cout << " Welcome to ChrisHTML version 0.75\n";
cout << " ***********************************************\n";
cout << "This version of ChrisHTML now includes the capability to add paragraphs of text\n";
cout << "and you may at tags to your text.\n";
cout << "Before you can do anything, you must set the text colour\nand the background colour...\n";
system("pause");
getFormat();
menu();
ofstream end("HTML Page.html", ios::ate);
end << "</BODY>\n</HTML>";
cout << ".:HTML page and source code created:.\n\n";
return 0;
}
void getFormat()
{
char title[50];
cout << "\nEnter the title for you page: ";
cin.getline(title, 50);
cout << "\n";
int bgcolor;
cout << "Enter what colour-code for your background (six digits): ";
cin >> bgcolor;
cout << "\n";
int textcolor;
cout << "Enter the colour for the text (six digits): ";
cin >> textcolor;
ofstream html("HTML Page.html", ios::ate);
html << "<!--Generated by ChrisHTML 0.7-->\n";
html << "<HTML>\n";
html << "<HEAD>\n";
html << "<TITLE>";
html << title;
html << "</TITLE>\n";
html << "<meta name=\"GENERATOR\" content=\"ChrisHTML 0.5\">";
html << "</HEAD>";
html << "<BODY ";
html << "bgcolor=";
html << bgcolor;
html << " text=";
html << textcolor;
html << " >\n";
}
void menu()
{
int option;
cout << "\nHere are you current options:\n";
cout << "[1]Add a new paragraph\n[2]Create HTML\n";
cout << "(more options in next version)\n";
cin >> option;
switch(option)
{
case 1:
getPara();
break;
case 2:
break;
default:
cout << "\nYou must enter a valid integer\n";
menu();
}
}
void getPara()
{
char para[150];
cout << "Enter the text for your new paragrah - use the <br> tag for a new line,\n";
cout << "press enter to stop editing this particular paragragh and go back to the menu:\n";
cin.getline(para, 150);
ofstream parag("HTML Page.html", ios::ate);
parag << "\n";
parag << "<p>";
parag << para;
parag << "<p>";
parag << "\n";
cout << "\n";
menu();
}
The area of the code where there is a problem, is here:
Code:
cout << "Enter the text for your new paragrah - use the <br> tag for a new line,\n";
cout << "press enter to stop editing this particular paragragh and go back to the menu:\n";
cin.getline(para, 150);
Thanks
-Chris