C++
CW2.png This article is a stub. You can help the CodeWorld community by expanding it.

Intro

C++ is an extension to the C programming language, developed by Bjarne Stroustrap between 1983 - 1985. C++ was originally called "C with Classes", but was renamed "C++" (++ being the increment by 1 operator). C++ is not platform-dependent; programs using it can be developed on any operating system.

Sample Program

Console

#include <iostream>
using namespace std;
 
int main() 
{
    cout << "Hello, World!" << endl; // Print "Hello, World!" to the console.
    return 0;
}

Qt GUI

#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QLabel *label = new QLabel("Hello, World!");
    label->show();
    return app.exec();
}

Colored text

Console

cout << "\x1b[31mHello World\x1b[0m\n";

This would give "Hello World" in red.

A list of valid text effects.

Useful Links

GUI Toolkits

There are numerous GUI Toolkits for C++, only a small few are listed here.

IDEs (Integrated Development Environments)

Free IDEs include Bloodshed's Dev-C++ and Code::Blocks.

c++
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License