skip to Main Content

Can we develop a completely working website using only Html,css and c++ , if yes please let me know

I just wanted to know if its possible , also my questions is in what areas can we use c++ as a backend programming language instead of java , can c++ be used for frontend?

2

Answers


  1. Creating a fully functional website using HTML, CSS, and C++ is possible, but not common. While C++ can be used for backend development, it’s more prevalent in areas requiring high performance, like gaming servers or complex algorithms. For frontend, HTML, CSS, and JavaScript are standard; In backend, C++ can replace Java for performance-critical tasks, such as systems programming or resource-intensive applications. Hope this clarifies!

    Login or Signup to reply.
  2. Wt (webtoolkit) is the only thing I’ve seen (so far) that builds a web-UI with C++. May be alternative solutions, but I’ve been wanting to play around with this library for some time. You’ll need a reverse-proxy layer like nginx to communicate via FastCGI to wt, or ISAPI for IIS.

    Example:

    #include <Wt/WApplication.h>
    #include <Wt/WBreak.h>
    #include <Wt/WContainerWidget.h>
    #include <Wt/WLineEdit.h>
    #include <Wt/WPushButton.h>
    #include <Wt/WText.h>
    
    class HelloApplication : public Wt::WApplication
    {
    public:
        HelloApplication(const Wt::WEnvironment& env);
    
    private:
        Wt::WLineEdit *nameEdit_;
        Wt::WText *greeting_;
    };
    
    HelloApplication::HelloApplication(const Wt::WEnvironment& env)
        : Wt::WApplication(env)
    {
        setTitle("Hello world");
    
        root()->addNew<Wt::WText>("Your name, please? ");
        nameEdit_ = root()->addNew<Wt::WLineEdit>();
        Wt::WPushButton *button = root()->addNew<Wt::WPushButton>("Greet me.");
        root()->addNew<Wt::WBreak>();
        greeting_ = root()->addNew<Wt::WText>();
        auto greet = [this]{
          greeting_->setText("Hello there, " + nameEdit_->text());
        };
        button->clicked().connect(greet);
    }
    
    int main(int argc, char **argv)
    {
        return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
          return std::make_unique<HelloApplication>(env);
        });
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search