Hirdetés

Új hozzászólás Aktív témák

  • WonderCSabo

    félisten

    #include <iostream>
    #include <fstream>
    #include <cmath>

    using namespace std;

    double ldiv(int a, int b)
    {
    double c=0;
    c=floor(a / b + 0.5);
    return c;
    }
    void wait(void)
    {
    fflush(stdin);
    cout<<"\nEnterrel kilep.";
    getchar();
    }
    void info(int &width)
    {
    bool withok=true;
    while (withok)
    {

    cout<< "A kepernyod szelessege pixelben? (csak az ertek pl. 1280 )"<<endl;
    cin>>width;
    if (width>0 && width<=2560)
    {
    withok=false;

    }
    if (width<=0)
    {
    cout<<"\nPozitiv lehet csak az ertek, ird be ujra!\n";

    width=0;

    };
    if (width>2560)
    {
    cout<<"\nA szelesseg max 2560 lehet!\n";

    width=0;

    };
    }

    }
    void finfo(string &fnev)
    {
    cout<<"\nHova szeretned menteni a fajlt ? (Ekezet nelkul, kiterjesztese .css legyen) \n(Abszolut utvonal, ha csak a nevet irod, akkor ez az exe melle kerul)\n";
    cin>>fnev;
    }
    void iras(string &fnev, int &width)
    {
    bool openok=true;
    ofstream f;

    while (openok)
    {
    finfo(fnev);
    f.open(fnev.c_str());
    if (f.good())
    {
    f<<

    "#page { width: " << (width - 42) << "px !important; }\n" <<
    "#main { width: " << (width - 44) << "px !important; }\n" <<
    "#center { width: " << (width - 422) << "px !important; }\n" <<
    ".anyagok li { width: " << ldiv(width - 440, 2) << "px !important; }\n" <<
    ".ajanlo { width: " << ldiv(width - 440, 2) << "px !important; }\n" <<
    ".hazaip { width: " << ldiv(width - 444, 2) << "px !important; }\n" <<
    ".cimrovat div { width: " << ldiv(width - 442, 3) << "px !important; }\n" <<
    ".cimrovat div h4 { background-position: " << (ldiv(width - 442, 3) - 17) << "px 0 !important; }\n" <<
    ".cimcikk { width: 602px !important; margin: 0 auto !important; }\n" <<
    ".defcnt { width: " << (width - 442) << "px !important; }\n" <<
    ".msgblk { width: " << (width - 422) << "px !important; }\n" <<
    ".msgblk .text { width: " << (width - 555) << "px !important; }\n" <<
    ".msgblk .text p, .msgblk .text pre { width: " << (width - 557) << "px !important; }\n" <<
    "";
    f.close();
    cout<<"\nA css kesz!\n";
    openok=false;
    }
    else
    {
    cout<<"nem sikerult letrehozni/megnyitni a fajlt :(\n";
    }
    }
    }
    int main()
    {
    string fnev;
    int width=0;
    info(width);
    iras(fnev,width);
    wait();
    return 0;
    }

Új hozzászólás Aktív témák