Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <fstream>
- using namespace std;
- // 1. Plik css, który jest prawidłowy
- // 2. Plik htmla
- // 3. Połączenie 1 i 2
- // 4. Większa możliwość edytowania
- // TYPY:
- // 0 - input type="text"
- // 1 - input type="password"
- // 2 - select name="nazwa_swiata" <- opcje
- // 3 - input type="radio"
- // 4 - input type="checkbox"
- // 5 - textarea name="Komentarz"
- // 6 - input type="submit"
- // 7 - input type="reset"
- class Formularz
- {
- string nazwa;
- int typ;
- string nazwa_diva;
- int width, height;
- string nazwa_form;
- int konstruktor; //1 - domyslny 2 - do main() 3- wlasny
- public:
- Formularz()
- {
- nazwa="testowa";
- typ=0;
- nazwa_diva="pole_wpr";
- width=250;
- height=50;
- nazwa_form="niech_to_dziala";
- konstruktor=1;
- }
- void GenerujDane()
- {
- if(typ==0)
- {
- cout<<"Wybrales pole do wprowadzania loginu."<<endl;
- ofstream plikcss;
- ofstream plikhtml; //tworzymy strumien
- plikcss.open("style.css", ios::out); //otwieramy plik
- if(konstruktor==1)
- {
- plikcss<<"."<<nazwa_diva<<endl;
- plikcss<<"{"<<endl;
- plikcss<<"\twidth:"<<width<<"px;"<<endl;
- plikcss<<"\theight:"<<height<<"px;"<<endl;
- plikcss<<"}"<<endl;
- plikcss.close();
- plikhtml.open("index.html", ios::out);
- plikhtml<<"<html>\n <head>\n\t<meta charset="<<char(34)<<"UTF-8/"<<char(34)<<">";
- plikhtml<<"<title>generowany plik</title>"<<endl;
- plikhtml<<"\t<link rel="<<char(34)<<"stylesheet"<<char(34)<<" href="<<char(34)<<"style.css"<<char(34)<<"type="<<
- char(34)<<"text/css"<<char(34)<<">\n";
- plikhtml<<"</head>"<<endl;
- plikhtml<<"<body>"<<endl;
- plikhtml<<endl;
- plikhtml<<"</body>"<<endl;
- plikhtml<<"</html>"<<endl;
- plikhtml.close();
- }
- }
- }
- };
- int main(int argc, char** argv) {
- Formularz qwer;
- qwer=Formularz();
- qwer.GenerujDane();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement