Advertisement
radek024

formularz

Oct 31st, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <fstream>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. // 1. Plik css, który jest prawidłowy
  9. // 2. Plik htmla
  10. // 3. Połączenie 1 i 2
  11. // 4. Większa możliwość edytowania
  12.  
  13. // TYPY:
  14. // 0 - input type="text"
  15. // 1 - input type="password"
  16. // 2 - select name="nazwa_swiata" <- opcje
  17. // 3 - input type="radio"
  18. // 4 - input type="checkbox"
  19. // 5 - textarea name="Komentarz"
  20. // 6 - input type="submit"
  21. // 7 - input type="reset"
  22.  
  23. class Formularz
  24. {
  25.     string nazwa;
  26.     int typ;
  27.     string nazwa_diva;
  28.     int width, height;
  29.     string nazwa_form;
  30.     int konstruktor; //1 - domyslny 2 - do main() 3- wlasny
  31.  
  32.     public:
  33.     Formularz()
  34.     {
  35.         nazwa="testowa";
  36.         typ=0;
  37.         nazwa_diva="pole_wpr";
  38.         width=250;
  39.         height=50;
  40.         nazwa_form="niech_to_dziala";
  41.         konstruktor=1;
  42.     }
  43.    
  44.     void GenerujDane()
  45. {
  46.  
  47.     if(typ==0)
  48.     {
  49.         cout<<"Wybrales pole do wprowadzania loginu."<<endl;
  50.         ofstream plikcss;
  51.         ofstream plikhtml; //tworzymy strumien
  52.         plikcss.open("style.css", ios::out); //otwieramy plik
  53.         if(konstruktor==1)
  54.         {
  55.             plikcss<<"."<<nazwa_diva<<endl;
  56.             plikcss<<"{"<<endl;
  57.             plikcss<<"\twidth:"<<width<<"px;"<<endl;
  58.             plikcss<<"\theight:"<<height<<"px;"<<endl;
  59.             plikcss<<"}"<<endl;
  60.             plikcss.close();
  61.             plikhtml.open("index.html", ios::out);
  62.             plikhtml<<"<html>\n <head>\n\t<meta charset="<<char(34)<<"UTF-8/"<<char(34)<<">";
  63.             plikhtml<<"<title>generowany plik</title>"<<endl;
  64.    
  65.             plikhtml<<"\t<link rel="<<char(34)<<"stylesheet"<<char(34)<<" href="<<char(34)<<"style.css"<<char(34)<<"type="<<
  66.                     char(34)<<"text/css"<<char(34)<<">\n";
  67.  
  68.             plikhtml<<"</head>"<<endl;
  69.             plikhtml<<"<body>"<<endl;
  70.            
  71.             plikhtml<<endl;
  72.            
  73.             plikhtml<<"</body>"<<endl;
  74.             plikhtml<<"</html>"<<endl;
  75.             plikhtml.close();
  76.         }
  77.     }
  78.    
  79.    
  80. }
  81. };
  82.  
  83.  
  84. int main(int argc, char** argv) {
  85.    
  86.     Formularz qwer;
  87.     qwer=Formularz();
  88.     qwer.GenerujDane();
  89.    
  90.     return 0;
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement