Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 09-15-2007, 01:34 PM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,654
Last Blog:
CherryPy(thon)
Rep Power: 29
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Good to hear you got it working!

I'll suggest you to completely rewrite the program, and have in mind the suggestions I gave you. If you do that, you'll probably hunt down all the errors you were getting, and in the end you'll get a better program.

This might sound hard, but you've the basic idea of what to do from the program you've already, so it will not take long to make a new one. Save the old sourcecode, if you're afraid of something is going wrong.

You don't have to do so, but let it be a little exercise, if you don't have anything else to do. :-)
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 09-15-2007, 06:52 PM
shibbythestoner's Avatar   
shibbythestoner shibbythestoner is offline
Programmer
 
Join Date: Jun 2007
Location: Scotland
Age: 17
Posts: 129
Rep Power: 6
shibbythestoner is on a distinguished road
Default

All my somewhat larger practice programs are working progresses so I re-write all of them from time to time. In fact, the fixed version I posted was completely re-typed out, but I did copy a lot of it's older workings I suppose. I think perhaps when I would come to trying to fix bugs i will just re-write the whole thing instead.
Thanks again.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 09-23-2007, 07:17 AM
shibbythestoner's Avatar   
shibbythestoner shibbythestoner is offline
Programmer
 
Join Date: Jun 2007
Location: Scotland
Age: 17
Posts: 129
Rep Power: 6
shibbythestoner is on a distinguished road
Default

Finally got round to re-writing it yesterday. It fails though. In theory half this stuff should work where it doesn't (and why is it so picky about where I can and can't put Sleep(n)? And some input places didn't work at random ;_; .
I'll have to go through and try to fix things sometime, and if that fails I'll try to write a simpler version and build around it. Oh well.

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
#include <conio.h>
#include <windows.h>

using namespace std;

void _modify();

int ex_mod=0;
int bgadv_ch, bgrandt, alignp, img_pos, txt_size, txtcol, txtcrandt, txtface, randomtxtface;

char b_yn, i_yn, u_yn;

string bgcolour, img_src, img_alt, txt_align, fontcolour, fontface, text;

int main() {
    
    srand(time (0));
    
    system("title .: HTML Writer :.");
    
    cout<<endl;
    cout<<".: HTML Writer :."<<endl;
    
    Sleep(2000);
    
    int quit_fc=0;
    
    while (quit_fc != 1) {
          
          system("cls");
          
          cout<<endl;
          cout<<"What would you like to do? -"<<endl;
          cout<<endl;
          
          int f_choice;
          
          cout<<"[1] Create / Overwrite page"<<endl;
          cout<<"[2] Open page with default browser"<<endl;
          cout<<endl;
          cout<<"[3] Exit"<<endl;
          
          cout<<endl;
          cout<<"Your choice -"<<endl;
          cout<<"[1/2/3/4] : ";
          cin>> f_choice;
          
          switch (f_choice) {
                 
                 case 1 :
                      
                      char sco_yn;
                      
                      cout<<"Are you sure you want to create or overwrite htmlwriter.htm? [y/n] : ";
                      cin>> sco_yn;
                      
                      if (sco_yn == 'y' || sco_yn == 'Y') {
                                 
                                 while (ex_mod != 1) {
                                       
                                       _modify();
                                       
                                 }
                                 
                      }
                      
                      else { }
                      
                      break;
                      
                 case 2 :
                      
                      char openfc_yn;
                      
                      cout<<"Attempt to open htmlwriter.htm in default browser? [y/n] : ";
                      cin>> openfc_yn;
                      
                      if (openfc_yn == 'y' || openfc_yn == 'Y') {
                                    
                                    cout<<"Opening htmlwriter.htm ..."<<endl;
                                    
                                    system("htmlwriter.htm");
                                    
                                    
                      }
                                    
                      else {}
                                    
                      Sleep(2000);
                                    
                      break;
                      
                 case 3 :
                      
                      char exitfc_yn;
                      
                      cout<<"Are you sure you want to quit? [y/n] : ";
                      cin>> exitfc_yn;
                      
                      if (exitfc_yn == 'y' || exitfc_yn == 'Y') {
                                    
                                    cout<<"Thank you for using HTML Writer."<<endl;
                                    cout<<"Hit any key to exit.";
                                    
                                    getch();
                                    
                                    return 0;
                                    
                      }
                      
                      else { }
                      
                      break;
                      
                 default : 
                         
                         cout<<"Error in input."<<endl;
                         
                         break;
                         
                 }
                 
                 cout<<"Returning to main menu...";
                 
                 Sleep(1000);
                 
    }
    
    return 0;
    
}

void _modify() {
     
     system("cls");
     
     ofstream html("htmlwriter.htm");
     
     html<<"<html>"<<endl;
     html<<"<head>"<<endl;
     
     cout<<endl;
     cout<<"File created."<<endl;
     
     string title;
     
     cout<<"What would you like as a title for your webpage? -"<<endl;
     cout<<"Title : ";
     getline(cin, title);
     
     html<<"<title>"<<title<<"</title>"<<endl;
     html<<"</head>"<<endl;
     
     cout<<"Title inserted."<<endl;
     
     int ex_bg=0;
     
     while (ex_bg != 1) {
           
           system("cls");
           
           int bgc_ch;
           
           cout<<endl;
           cout<<"What would you like as a background colour? -"<<endl;
           cout<<endl;
           
           cout<<"[1 ] White"<<endl;
           cout<<"[2 ] Black"<<endl;
           cout<<"[3 ] Green"<<endl;
           cout<<"[4 ] Yellow"<<endl;
           cout<<"[5 ] Orange"<<endl;
           cout<<"[6 ] Pink"<<endl;
           cout<<"[7 ] Brown"<<endl;
           cout<<"[8 ] Red"<<endl;
           cout<<"[9 ] Purple"<<endl;
           cout<<"[10] Blue"<<endl;
           cout<<"[11] Aqua"<<endl;
           cout<<"[12] Grey"<<endl;
           cout<<endl;
           cout<<"[13] Randomise!"<<endl;
           cout<<"[14] Advanced..."<<endl;
           
           cout<<endl;
           cout<<"Background -"<<endl;
           cout<<"[1/2/3/4/5/6/7/8/9/10/11/12/13/14] : ";
           cin>> bgc_ch;
           
           if (bgc_ch > 0 && bgc_ch < 13) {
                      
                      switch (bgc_ch) {
                             
                             case 1 :
                                  
                                  (bgcolour="white");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 2 :
                                  
                                  (bgcolour="black");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 3 :
                                  
                                  (bgcolour="green");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 4 :
                                  
                                  (bgcolour="yellow");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 5 :
                                  
                                  (bgcolour="orange");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 6 :
                                  
                                  (bgcolour="pink");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 7 :
                                  
                                  (bgcolour="brown");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 8 :
                                  
                                  (bgcolour="red");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 9 :
                                  
                                  (bgcolour="purple");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 10 :
                                  
                                  (bgcolour="blue");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 11 :
                                  
                                  (bgcolour="aqua");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             case 12 :
                                  
                                  (bgcolour="gray");
                                  
                                  (ex_bg=1);
                                  
                                  break;
                                  
                             default :
                                     
                                     cout<<"Error..."<<endl;
                                     
                                     (ex_bg=0);
                                     
                                     break;
                                     
                      }
           }
           
           else if (bgc_ch == 13) {
                
                int ex_bgrand=0;
                
                while (ex_bgrand != 1) {
                      
                      system("cls");
                      
                      cout<<endl;
                      cout<<"How would you like to randomise the background colour? -"<<endl;
                      cout<<endl;
                      
                      cout<<"[1] Pick one random colour now (program)"<<endl;
                      cout<<"[2] Choose a different colour each time the page loads (Javascript)"<<endl;
                      
                      cout<<endl;
                      cout<<"Randomise with [1/2] : ";
                      cin>> bgrandt;
                      
                      if (bgrandt == 1) {
                                  
                                  int ex_bgrandom=0;
                                  
                                  while (ex_bgrandom != 1) {
                                        
                                        cout<<endl;
                                        cout<<"Randomising..."<<endl;
                                        
                                        int bgrandom;
                                        (bgrandom = 1 + rand() % 12);
                                        
                                        switch (bgrandom) {
                                               
                                               case 1 :
                                                    
                                                    (bgcolour="white");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 2 :
                                                    
                                                    (bgcolour="black");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 3 :
                                                    
                                                    (bgcolour="green");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 4 :
                                                    
                                                    (bgcolour="yellow");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 5 :
                                                    
                                                    (bgcolour="orange");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 6 :
                                                    
                                                    (bgcolour="pink");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 7 :
                                                    
                                                    (bgcolour="brown");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 8 :
                                                    
                                                    (bgcolour="red");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 9 :
                                                    
                                                    (bgcolour="purple");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 10 :
                                                    
                                                    (bgcolour="blue");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 11 :
                                                    
                                                    (bgcolour="aqua");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               case 12 :
                                                    
                                                    (bgcolour="gray");
                                                    
                                                    (ex_bgrandom=1);
                                                    
                                                    break;
                                                    
                                               default :
                                                       
                                                       cout<<"Error..."<<endl;
                                                       
                                                       Sleep(200);
                                                       
                                                       break;
                                                       
                                        }
                                        
                                        (ex_bgrand=1);
                                        
                      }
                      
                      (ex_bg=1);
                      
                      }
                                  
                      else if (bgrandt == 2) {
                           
                           (bgcolour="Randomised using Javascript");
                           
                           (ex_bgrand=1);
                           
                      }
                      
                      else {
                           
                           cout<<"Error..."<<endl;
                           
                      }
                      
                }
                
           }
           
           else if (bgc_ch == 14) {
                
                int bgadv_ex=0;
                
                while (bgadv_ex != 1) {
                      
                      system("cls");
                      
                      cout<<endl;
                      cout<<"Advanced background settings -"<<endl;
                      cout<<endl;
                      
                      cout<<"[1] Specify a colour"<<endl;
                      cout<<"[2] Use a background image"<<endl;
                      cout<<"[3] Cancel"<<endl;
                      
                      cout<<"Choice -"<<endl;
                      cout<<"[1/2/3] : ";
                      cin>> bgadv_ch;
                      
                      switch (bgadv_ch) {
                             
                             case 1 :
                                  
                                  break;
                                  
                             case 2 :
                                  
                                  cout<<"Image address : ";
                                  getline(cin, bgcolour);
                                  
                                  (bgadv_ex=1);
                                  
                                  break;
                                  
                             case 3 :
                                  
                                  (bgadv_ex=1);
                                  
                                  break;
                                  
                             default :
                                     
                                     cout<<"Error..."<<endl;
                                     
                                     (bgadv_ex=0);
                                     
                      }
                      
                      if (bgadv_ch == 1) {
                                   
                                   cout<<"Colour : ";
                                   getline(cin, bgcolour);
                                   
                                   (bgadv_ex=1);
                                   
                      }
                      
                }
                
                (ex_bg=1);
                      
           }
           
           else {
                
                cout<<"Error..."<<endl;
                
                (ex_bg=0);
                
           }
           
           Sleep(1000);
           
     }
           
           cout<<endl;
           cout<<"Writing background HTML..."<<endl;
           
           if (bgadv_ch == 2) {
                        
                        html<<"<body background='"<<bgcolour<<"'>"<<endl;
                        
           }
           
           else if (bgrandt == 2) {
                
                html<<"<body>"<<endl;
                
                cout<<"Writing background colour Javascript..."<<endl;
                
                html<<"<script type='text/javascript'>"<<endl;
                html<<"var jbgcolour=Math.floor(Math.random()*12+1);"<<endl;
                html<<"switch (jbgcolour) {"<<endl;
                html<<"       case 1 :"<<endl;
                html<<"            document.bgColor='white';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 2 :"<<endl;
                html<<"            document.bgColor='black';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 3 :"<<endl;
                html<<"            document.bgColor='green';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 4 :"<<endl;
                html<<"            document.bgColor='yellow';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 5 :"<<endl;
                html<<"            document.bgColor='orange';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 6 :"<<endl;
                html<<"            document.bgColor='pink';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 7 :"<<endl;
                html<<"            document.bgColor='brown';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 8 :"<<endl;
                html<<"            document.bgColor='red';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 9 :"<<endl;
                html<<"            document.bgColor='purple';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 10 :"<<endl;
                html<<"            document.bgColor='blue';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 11 :"<<endl;
                html<<"            document.bgColor='aqua';"<<endl;
                html<<"            break;"<<endl;
                html<<"       case 12 :"<<endl;
                html<<"            document.bgColor='gray';"<<endl;
                html<<"            break;"<<endl;
                html<<"       default :"<<endl;
                html<<"            document.bgColor='white';"<<endl;
                html<<"            break;"<<endl;
                html<<"}"<<endl;
                html<<"</script>"<<endl;
                
                cout<<"Finished writing Javascript."<<endl;
                
           }
           
           else {
                
                html<<"<body bgcolor='"<<bgcolour<<"'>"<<endl;
                
           }
           
           cout<<"Finished Writing HTML."<<endl;
           cout<<endl;
           cout<<"Background : "<<bgcolour<<endl;
           cout<<endl;
           cout<<"Finished configuring background."<<endl;
           
           cout<<"Hit any key to continue...";
           getch();
           
           int align_ex=0;
           
           string alignw;
           
           while (align_ex != 1) {
                 
                 
                 system("cls");
                 
                 cout<<endl;
                 cout<<"Where would you like to align your page? -"<<endl;
                 cout<<endl;
                 
                 cout<<"[1] Left [2] Centre [3] Right"<<endl;
                 
                 cout<<endl;
                 cout<<"Align page -"<<endl;
                 cout<<"[1/2/3] : ";
                 cin>> alignp;
                 
                 switch (alignp) {
                        
                        case 1 :
                             
                             (alignw="left");
                             
                             (align_ex=1);
                             
                             break;
                             
                        case 2 :
                             
                             (alignw="center");
                             
                             (align_ex=1);
                             
                             break;
                             
                        case 3 :
                             
                             (alignw="right");
                             
                             (align_ex=1);
                             
                             break;
                             
                        default :
                                
                                cout<<"Error..."<<endl;
                                
                                Sleep(200);
                                
                                break;
                                
                 }
                 
                 html<<"<div align='"<<alignw<<"'>"<<endl;
                 
                 cout<<"Finished aligning page."<<endl;
                 
                 cout<<"Hit any key to continue..."<<endl;
                 getch();
                 
                 html<<"<table border='0' cellpadding='0' cellspacing='0'>"<<endl;
                 html<<"<tr>"<<endl;
                 
                 char img_yn;
                 
                 cout<<"Would you like to include an image on your page? [y/n] : ";
                 cin>> img_yn;
                 
                 if (img_yn == 'y' || img_yn == 'Y') {
                             
                             system("cls");
                             
                             cout<<endl;
                             cout<<"Address of file : ";
                             getline(cin, img_src);
                             
                             cout<<"Alternative text : ";
                             getline(cin, img_alt);
                             
                             int imgpos_ex=0;
                             
                             while (imgpos_ex != 1) {
                                   
                                   system("cls");
                                   
                                   cout<<endl;
                                   cout<<"Where would you like to position the image? -"<<endl;
                                   cout<<endl;
                                   
                                   cout<<"[1] To the left"<<endl;
                                   cout<<"[2] At the top"<<endl;
                                   cout<<"[3] To the right"<<endl;
                                   
                                   cout<<endl;
                                   cout<<"Image position -"<<endl;
                                   cout<<"[1/2/3] : "<<endl;
                                   cin>> img_pos;
                                   
                                   switch (img_pos) {
                                          
                                          case 1 :
                                               
                                               html<<"<td>"<<endl;
                                               html<<"<img src='"<<img_src<<"' alt='"<<img_alt<<"'>"<<endl;
                                               html<<"</td>"<<endl;
                                               html<<"<td>"<<endl;
                                               
                                               cout<<"Image inserted."<<endl;
                                               
                                               (imgpos_ex=1);
                                               
                                               break;
                                               
                                          case 2 :
                                               
                                               html<<"<td valign='top'>"<<endl;
                                               html<<"<div align='center'>"<<endl;
                                               html<<"<img src='"<<img_src<<"' alt='"<<img_alt<<"'>"<<endl;
                                               html<<"</div>"<<endl;
                                               html<<"<p>"<<endl;
                                               
                                               cout<<"Image inserted."<<endl;
                                               
                                               (imgpos_ex=1);
                                               
                                               break;
                                               
                                          case 3 :
                                               
                                               cout<<"Image will be inserted later."<<endl;
                                               
                                               html<<"<td valign='top'>"<<endl;
                                               
                                               (imgpos_ex=1);
                                               
                                               break;
                                               
                                          default :
                                                  
                                                  cout<<"Error..."<<endl;
                                                  
                                                  Sleep(200);
                                                  
                                                  break;
                                                  
                                   }
                                   
                             }
                 
                 }
                 
                 else {
                      
                      (img_pos=0);
                      
                      html<<"<td valign='top'>"<<endl;
                      
                      cout<<"No image used."<<endl;
                      
                 }
                 
                 cout<<"Finished configuring image."<<endl;
                 
                 cout<<"Hit any key to continue..."<<endl;
                 getch();
                 
                 int alignt_ex=0;
                 
                 while (alignt_ex != 1) {
                       
                       int txt_al;
                       
                       system("cls");
                       
                       cout<<endl;
                       cout<<"Where would you like to align the text? -"<<endl;
                       cout<<endl;
                       
                       cout<<"[1] Left [2] Centre [3] Right"<<endl;
                       
                       cout<<endl;
                       cout<<"Align text -"<<endl;
                       cout<<"[1/2/3] : ";
                       cin>> txt_al;
                       
                       switch (txt_al) {
                              
                              case 1 :
                                   
                                   (txt_align="left");
                                   
                                   (alignt_ex=1);
                                   
                                   break;
                                   
                              case 2 :
                                   
                                   (txt_align="center");
                                   
                                   (alignt_ex=1);
                                   
                                   break;
                                   
                              case 3 :
                                   
                                   (txt_align="right");
                                   
                                   (alignt_ex=1);
                                   
                                   break;
                                   
                              default :
                                      
                                      cout<<"Error..."<<endl;
                                      
                                      Sleep(200);
                                      
                                      (alignt_ex=0);
                                      
                                      break;
                                      
                       }
                       
                 }
                 
                 html<<"<div align='"<<txt_align<<"'>"<<endl;
                 
                 cout<<"Finished configuring text alignment."<<endl;
                 
                 cout<<"Hit any key to continue..."<<endl;
                 getch();
                 
                 int txts_ex=0;
                 
                 while (txts_ex != 1) {
                       
                       system("cls");
                       
                       cout<<endl;
                       cout<<"What size would you like the text to be? -"<<endl;
                       cout<<endl;
                       
                       cout<<"[1] Smallest"<<endl;
                       cout<<"[2]"<<endl;
                       cout<<"[3] Default"<<endl;
                       cout<<"[4]"<<endl;
                       cout<<"[5]"<<endl;
                       cout<<"[6]"<<endl;
                       cout<<"[7] Largest"<<endl;
                       
                       cout<<endl;
                       cout<<"Size -"<<endl;
                       cout<<"[1/2/3/4/5/6/7] : ";
                       cin>> txt_size;
                       
                       if (txt_size < 1) {
                                    
                                    cout<<"Error..."<<endl;
                                    
                                    Sleep(200);
                                    
                       }
                       
                       else if (txt_size > 7) {
                            
                            cout<<"Error..."<<endl;
                            
                            Sleep(200);
                            
                       }
                       
                       else {
                            
                            (txts_ex=1);
                            
                            }
                            
                 }
                 
                 int txtc_ex=0;
                 
                 while (txtc_ex != 1) {
                       
                       system("cls");
                       
                       cout<<endl;
                       cout<<"What colour would you like the text to be? -"<<endl;
                       cout<<"Note - Background is : "<<bgcolour<<endl;
                       cout<<endl;
                       
                       cout<<"[1 ] Black"<<endl;
                       cout<<"[2 ] White"<<endl;
                       cout<<"[3 ] Green"<<endl;
                       cout<<"[4 ] Yellow"<<endl;
                       cout<<"[5 ] Orange"<<endl;
                       cout<<"[6 ] Pink"<<endl;
                       cout<<"[7 ] Brown"<<endl;
                       cout<<"[8 ] Red"<<endl;
                       cout<<"[9 ] Purple"<<endl;
                       cout<<"[10] Blue"<<endl;
                       cout<<"[11] Aqua"<<endl;
                       cout<<"[12] Grey"<<endl;
                       cout<<endl;
                       cout<<"[13] Randomise!"<<endl;
                       cout<<"[14] Advanced..."<<endl;
                       
                       cout<<endl;
                       cout<<"Font colour -"<<endl;
                       cout<<"[1/2/3/4/5/6/7/8/9/10/11/12/13/14] : ";
                       cin>> txtcol;
                       
                       if (txtcol > 0 && txtcol < 13) {
                                   
                                   switch (txtcol) {
                                          
                                          case 1 :
                                               
                                               (fontcolour="black");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 2 :
                                               
                                               (fontcolour="white");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 3 :
                                               
                                               (fontcolour="green");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 4 :
                                               
                                               (fontcolour="yellow");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 5 :
                                               
                                               (fontcolour="orange");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 6 :
                                               
                                               (fontcolour="pink");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 7 :
                                               
                                               (fontcolour="brown");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 8 :
                                               
                                               (fontcolour="red");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 9:
                                               
                                               (fontcolour="purple");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 10 :
                                               
                                               (fontcolour="blue");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 11 :
                                               
                                               (fontcolour="aqua");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          case 12 :
                                               
                                               (fontcolour="gray");
                                               
                                               (txtc_ex=1);
                                               
                                               break;
                                               
                                          default :
                                                  
                                                  cout<<"Error..."<<endl;
                                                  
                                                  Sleep(200);
                                                  
                                                  break;
                                                  
                                   }
                                   
                       }
                       
                       else if (txtcol == 13) {
                            
                            int txtcrand_ex=0;
                            
                            while (txtcrand_ex != 1) {
                                  
                                  system("cls");
                                  
                                  cout<<endl;
                                  cout<<"How would you like to randomise the font colour? -"<<endl;
                                  cout<<endl;
                                  
                                  cout<<"[1] Pick one random colour now (program)"<<endl;
                                  cout<<"[2] Choose a different colour each time the page loads (Javascript)"<<endl;
                                  
                                  cout<<endl;
                                  cout<<"Randomise with [1/2] : ";
                                  cin>> txtcrandt;
                                  
                                  if (txtcrandt == 1) {
                                                
                                                int ex_txtcrandom=0;
                                                
                                                while (ex_txtcrandom != 1) {
                                                      
                                                      cout<<"Randomising..."<<endl;
                                                      
                                                      int txtcrand;
                                                      (txtcrand = 1 + rand() % 12);
                                                      
                                                      switch (txtcrand) {
                                                             
                                                             case 1 :
                                                                  
                                                                  (fontcolour="black");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 2 :
                                                                  
                                                                  (fontcolour="white");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 3 :
                                                                  
                                                                  (fontcolour="green");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 4 :
                                                                  
                                                                  (fontcolour="yellow");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 5 :
                                                                  
                                                                  (fontcolour="orange");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 6 :
                                                                  
                                                                  (fontcolour="pink");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 7 :
                                                                  
                                                                  (fontcolour="brown");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 8 :
                                                                  
                                                                  (fontcolour="red");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 9 :
                                                                  
                                                                  (fontcolour="purple");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 10 :
                                                                  
                                                                  (fontcolour="blue");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 11 :
                                                                  
                                                                  (fontcolour="aqua");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             case 12 :
                                                                  
                                                                  (fontcolour="gray");
                                                                  
                                                                  (ex_txtcrandom=1);
                                                                  
                                                                  break;
                                                                  
                                                             default :
                                                                     
                                                                     cout<<"Error..."<<endl;
                                                                     
                                                                     Sleep(100);
                                                                     
                                                                     break;
                                                                     
                                                      }
                                                      
                                  }
                                  
                                  (txtcrand_ex=1);
                                  
                            }
                            
                            else if (txtcrandt == 2) {
                                 
                                 (fontcolour="Randomised using Javascript");
                                 
                                 (txtcrand_ex=1);
                                 
                            }
                            
                            else {
                                 
                                 cout<<"Error..."<<endl;
                                 
                                 Sleep(200);
                                 
                            }
                            
                       }
                       
                 }
                 
                 else if (txtcol == 14) {
                      
                      int txtcadv_ex=0;
                      
                      while (txtcadv_ex != 1) {
                            
                            system("cls");
                            
                            int advtxtcc;
                            
                            cout<<endl;
                            cout<<"Advanced font colour settings"<<endl;
                            cout<<endl;
                            
                            cout<<"[1] Specify a colour"<<endl;
                            cout<<"[2] Cancel"<<endl;
                            
                            cout<<endl;
                            cout<<"Choice [1/2] : ";
                            cin>> advtxtcc;
                            
                            if (advtxtcc == 1) {
                                         
                                         cout<<endl;
                                         cout<<"Colour : ";
                                         getline(cin, fontcolour);
                                         
                                         (txtcadv_ex=1);
                                         (txtc_ex=1);
                                         
                            }
                            
                            else if (advtxtcc == 2) {
                                 
                                 (txtcadv_ex=1);
                                 
                            }
                            
                            else {
                                 
                                 cout<<"Error..."<<endl;
                                 
                                 Sleep(200);
                                 
                            }
                            
                      }
                 
                 }
                 
                 else {
                      
                      cout<<"Error..."<<endl;
                      
                      Sleep(200);
                      
                 }
                 
                 cout<<"Font colour : "<<fontcolour<<endl;
                 cout<<"Finished configuring font colour."<<endl;
                 
                 cout<<endl;
                 cout<<"Hit any key to continue..."<<endl;
                 getch();
                 
                 int ex_fontface=0;
                 
                 while (ex_fontface != 1) {
                       
                       system("cls");
                       
                       cout<<endl;
                       cout<<"What font would you like to use? -"<<endl;
                       cout<<endl;
                       
                       cout<<"[1 ] Arial"<<endl;
                       cout<<"[2 ] Times New Roman"<<endl;
                       cout<<"[3 ] Comic Sans MS"<<endl;
                       cout<<"[4 ] Bookman Old Style"<<endl;
                       cout<<"[5 ] Courier New"<<endl;
                       cout<<"[6 ] Algerian"<<endl;
                       cout<<"[7 ] Blackadder ITC"<<endl;
                       cout<<"[8 ] Jokerman !"<<endl;
                       cout<<endl;
                       cout<<"[9 ] Randomise!"<<endl;
                       cout<<"[10] Advanced..."<<endl;
                       
                       cout<<endl;
                       cout<<"Font face -"<<endl;
                       cout<<"[1/2/3/4/5/6/7/8/9/10] : ";
                       cin>> txtface;
                       
                       if (txtface > 0 && txtface < 9) {
                                   
                                   switch (txtface) {
                                          
                                          case 1 :
                                               
                                               (fontface="Arial");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 2 :
                                               
                                               (fontface="Times New Roman");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 3 :
                                               
                                               (fontface="Comic Sans MS");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 4 :
                                               
                                               (fontface="Bookman Old Style");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 5 :
                                               
                                               (fontface="Courier New");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 6 :
                                               
                                               (fontface="Algerian");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 7 :
                                               
                                               (fontface="Blackadder ITC");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          case 8 :
                                               
                                               (fontface="Jokerman");
                                               
                                               (ex_fontface=1);
                                               
                                               break;
                                               
                                          default :
                                                  
                                                  cout<<"Error..."<<endl;
                                                  
                                                  Sleep(200);
                                                  
                                                  break;
                                                  
                                   }
                                   
                       }
                       
                       else if (txtface == 9) {
                            
                            int ex_randomtxtfaceo=0;
                            
                            while (ex_randomtxtfaceo != 1) {
                                  
                                  system("cls");
                                  
                                  cout<<endl;
                                  cout<<"How would you like to randomise the font face? -"<<endl;
                                  cout<<endl;
                                  
                                  cout<<"[1] Pick one random font now (program)"<<endl;
                                  cout<<"[2] Choose a different font each time the page loads (Javascript)"<<endl;
                                  
                                  cout<<endl;
                                  cout<<"Randomise with [1/2] : ";
                                  cin>> randomtxtface;
                                  
                                  if (randomtxtface == 1) {
                                                    
                                                    int ex_randomisingtxtf=0;
                                                    
                                                    while (ex_randomisingtxtf != 1) {
                                                          
                                                          cout<<"Randomising..."<<endl;
                                                          
                                                          int randomtxtfp;
                                                          (randomtxtfp = 1 + rand() % 8);
                                                          
                                                          switch (randomtxtfp) {
                                                                 
                                                                 case 1 :
                                                                      
                                                                      (fontface="Arial");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 2 :
                                                                      
                                                                      (fontface="Times New Roman");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 3 :
                                                                      
                                                                      (fontface="Comic Sans MS");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 4 :
                                                                      
                                                                      (fontface="Bookman Old Style");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 5 :
                                                                      
                                                                      (fontface="Courier New");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 6 :
                                                                      
                                                                      (fontface="Algerian");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 7 :
                                                                      
                                                                      (fontface="Blackadder ITC");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 case 8 :
                                                                      
                                                                      (fontface="Jokerman");
                                                                      
                                                                      (ex_randomisingtxtf=1);
                                                                      
                                                                      break;
                                                                      
                                                                 default :
                                                                         
                                                                         cout<<"Error..."<<endl;
                                                                         
                                                                         Sleep(200);
                                                                         
                                                                         break;
                                                                         
                                                          }
                                                          
                                                    }
                                                    
                                                    (ex_fontface=1);
                                                    (ex_randomtxtfaceo=1);
                                                    
                                  }
                                  
                                  else if (randomtxtface == 2) {
                                       
                                       (fontface="Randomised using Javascript");
                                       
                                       (ex_fontface=1);
                                       (ex_randomtxtfaceo=1);
                                       
                                  }
                                  
                                  else {
                                       
                                       cout<<"Error..."<<endl;
                                       
                                       Sleep(200);
                                       
                                  }
                                  
                       }
                       
                 }
                 
                 cout<<"Finished configuring font face."<<endl;
                 cout<<endl;
                 
                 cout<<"Hit any key to continue..."<<endl;
                 getch();
                 
                 system("cls");
                 
                 cout<<endl;
                 
                 html<<"<font face='Arial'><h1>"<<title<<"</h1></font>"<<endl;
                 
                 char usebiu_yn;
                 
                 cout<<"Would you like to use bold, italics, or underline on your text? [y/n] : ";
                 cin>> usebiu_yn;
                 
                 if (usebiu_yn == 'y' || usebiu_yn == 'Y') {
                               
                               cout<<endl;
                               cout<<"Make text bold? [y/n] : ";
                               cin>> b_yn;
                               cout<<"Make text italics? [y/n] : ";
                               cin>> i_yn;
                               cout<<"Underline text? [y/n] : ";
                               cin>> u_yn;
                               
                 }
                 
                 cout<<endl;
                 cout<<"Finished configuring text."<<endl;
                 
                 cout<<endl;
                 cout<<"Hit any key to continue..."<<endl;
                 getch();
                 
                 system("cls");
                 
                 cout<<endl;
                 cout<<"Writing font HTML..."<<endl;
                 
                 if (b_yn == 'y' || b_yn == 'Y') {
                          
                          html<<"<b>"<<endl;
                          
                 }
                 
                 if (i_yn == 'y' || i_yn == 'Y') {
                          
                          html<<"<i>"<<endl;
                          
                 }
                 
                 if (u_yn == 'y' || u_yn == 'Y') {
                          
                          html<<"<u>"<<endl;
                          
                 }
                 
                 html<<"<font size='"<<txt_size<<"'>"<<endl;
                 
                 if (txtcrandt == 2) {
                               
                               cout<<"Writing font colour Javascript..."<<endl;
                               
                               html<<"<script type='text/javascript'>"<<endl;
                               html<<"var randtxtcol=Math.floor(Math.random()*12+1);"<<endl;
                               html<<"var txtcol;"<<endl;
                               html<<"switch (randtxtcol) {"<<endl;
                               html<<"       case 1 :"<<endl;
                               html<<"            txtcol='black';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 2 :"<<endl;
                               html<<"            txtcol='white';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 3 :"<<endl;
                               html<<"            txtcol='green';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 4 :"<<endl;
                               html<<"            txtcol='yellow';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 5 :"<<endl;
                               html<<"            txtcol='orange';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 6 :"<<endl;
                               html<<"            txtcol='pink';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 7 :"<<endl;
                               html<<"            txtcol='brown';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 8 :"<<endl;
                               html<<"            txtcol='red';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 9 :"<<endl;
                               html<<"            txtcol='purple';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 10 :"<<endl;
                               html<<"            txtcol='blue';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 11 :"<<endl;
                               html<<"            txtcol='aqua';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       case 12 :"<<endl;
                               html<<"            txtcol='gray';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"       default :"<<endl;
                               html<<"            txtcol='black';"<<endl;
                               html<<"            break;"<<endl;
                               html<<"}"<<endl;
                               html<<"document.write('<font color=''+txtcol+''>');"<<endl;
                               html<<"</script>"<<endl;
                               
                               cout<<"Finished writing Javascript."<<endl;
                               
                 }
                 
                 else {
                      
                      html<<"<font color='"<<fontcolour<<"'>"<<endl;
                      
                 }
                 
                 if (randomtxtface == 2) {
                                   
                                   cout<<"Writing font Javascript..."<<endl;
                                   
                                   html<<"<script type='text/javascript'>"<<endl;
                                   html<<"var randface=Math.floor(Math.random()*8+1);"<<endl;
                                   html<<"var face;"<<endl;
                                   html<<"switch (randface) {"<<endl;
                                   html<<"       case 1 :"<<endl;
                                   html<<"            face='Arial';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 2 :"<<endl;
                                   html<<"            face='Times New Roman';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 3 :"<<endl;
                                   html<<"            face='Comic Sans MS';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 4 :"<<endl;
                                   html<<"            face='Bookman Old Style';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 5 :"<<endl;
                                   html<<"            face='Courier New';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 6 :"<<endl;
                                   html<<"            face='Algerian';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 7 :"<<endl;
                                   html<<"            face='Blackadder ITC';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       case 8 :"<<endl;
                                   html<<"            face='Jokerman';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"       default :"<<endl;
                                   html<<"            face='Arial';"<<endl;
                                   html<<"            break;"<<endl;
                                   html<<"}"<<endl;
                                   html<<"document.write('<font face=''+face+''>');"<<endl;
                                   html<<"</script>"<<endl;
                                   
                                   cout<<"Finished writing Javascript."<<endl;
                                   
                 }
                 
                 else {
                      
                      html<<"<font face='"<<fontface<<"'>"<<endl;
                      
                 }
                 
                 cout<<"Finished writing HTML."<<endl;
                 
                 Sleep(1000);
                 
                 system("cls");
                 
                 cout<<endl;
                 cout<<"It's time to insert some text into your page."<<endl;
                 cout<<endl;
                 cout<<"Type 'x' as a line entry at any time to stop writing."<<endl;
                 
                 int lineno=0;
                 
                 (text="");
                 
                 while (text != "x" && text != "X") {
                       
                       lineno++;
                       
                       html<<text<<endl;
                       html<<"<br>"<<endl;
                       
                       cout<<"Line "<<lineno<<" : ";
                       getline(cin, text);
                       
                 }
                 
                 cout<<"Finished writing."<<endl;
                 
                 cout<<"Finishing off HTML..."<<endl;
                 
                 html<<"</font>"<<endl;
                 
                 if (txtcrandt == 2) {
                               
                               html<<"</font>"<<endl;
                               
                 }
                 
                 if (randomtxtface == 2) {
                                   
                                   html<<"</font>"<<endl;
                                   
                 }
                 
                 if (b_yn == 'y' || b_yn == 'Y') {
                          
                          html<<"</b>"<<endl;
                          
                 }
                 
                 if (i_yn == 'y' || i_yn == 'Y') {
                          
                          html<<"</i>"<<endl;
                          
                 }
                 
                 if (u_yn == 'y' || u_yn == 'Y') {
                          
                          html<<"</u>"<<endl;
                          
                 }
                 
                 html<<"</div>"<<endl;
                 html<<"</td>"<<endl;
                 
                 if (img_pos == 3) {
                             
                             html<<"<td>"<<endl;
                             html<<"<img src='"<<img_src<<"' alt='"<<img_alt<<"'>"<<endl;
                             html<<"</td>"<<endl;
                             
                             cout<<"Image inserted."<<endl;
                             
                 }
                 
                 html<<"</tr>"<<endl;
                 html<<"</table>"<<endl;
                 html<<"</div>"<<endl;
                 html<<"</body>"<<endl;
                 html<<"<!-- Page written using HTML Writer 2 -->"<<endl;
                 html<<"</html>"<<endl;
                 
                 html.close();
                 
                 cout<<"Finished writing HTML."<<endl;
                 
                 char openpn_yn;
                 
                 cout<<endl;
                 cout<<"Would you like to open htmlwriter.htm in your default browser now? [y/n] : ";
                 
                 if (openpn_yn == 'y' || openpn_yn == 'Y') {
                               
                               system("htmlwriter.htm");
                               
                 }
                 
                 char modagain_yn;
                 
                 c