Important: Please read the Qt Code of Conduct -

Easy app that can count in Qt and C++

  • Hello. I am fourteen and i'm from the czech republic so sorry for my english please.

    my problem:
    I don't know how to write easy app in c++ and qt.

    in TUI can look such as this:

    @#include <iostream>
    using namespace std;
    int main(){
    int a,b;
    cout << "please write first number: ";
    cin >> a;
    cout << endl
    << "please write second number: ";
    cin >> b;
    cout << endl;
    cout << "answer is: " << a+b << endl;
    return 0;

    how it may look in Qt?

    thank you for answer!

  • welcome to devnet

    The example code you are giving is simple C++ code. There are different ways to do it with Qt. Since you are looking for an example to start off with Qt I would suggest to start with the "tutorials": and some examples. The "example code": should be installed together with the Qt libs.

  • In Qt Creater, create a New Project.
    Select Applications in Projects sidebar.
    Then, Qt Console Application.
    Click Choose and give Project a name.
    After Wizard dialog finished, you can use the code above in main.cpp file.
    Click Run (green arrow icon) to compile and run.

Log in to reply