c++ Question

Hestia 1 Reputation point
2021-08-30T18:55:55.693+00:00

may i ask .why c++ executable program run on CMD ?..
always there is that CMD window appear at the start of the program .. why ?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,848 questions
{count} votes

3 answers

Sort by: Most helpful
  1. RLWA32 46,861 Reputation points
    2021-08-30T19:46:08.47+00:00

    Generally speaking C++ is used to create two different types of applications. Windows desktop applications, often called GUI (graphical user interface) applications, display windows for their user interface. The other type is a console application. The command prompt (cmd.exe) is an example of a console application. What you see when you start a console application written in C++ is the console that Windows creates for the program to display its user interface.

    When a console application starts to run what you see depends on how the application was started. For example, If it was started by double clicking in Explorer what you see is the console created by Windows for the application. This console is not the command prompt displayed by cmd.exe. However, when a console application is started by another console application then Windows default behavior is for new console application to inherit the console of the parent process. An example of this is running a console application from a command prompt. The same console is shared by cmd.exe and the console application.

    1 person found this answer helpful.

  2. Sam of Simple Samples 5,546 Reputation points
    2021-08-30T21:50:04.967+00:00

    The C++ standard only supports text, no graphical interface. When a program developed using only the C++ standard is executed the operating system uses a shell to execute it; in Windows a shell is called a console or a command prompt, among other things. A Windows console program can definitely also use non-standard C++.

    1 person found this answer helpful.
    0 comments No comments

  3. Ahmed Saber 1 Reputation point
    2021-11-13T21:50:35.833+00:00

    Because you're learning console programming not Graphical User Interface (GUI) programming...
    Buttons , text areas , images and more are called Graphical User Interface elements...
    You can switch to GUI after being good enough in console screen (that simple black screen).
    If the black color is annoying you , you can change it and the font color ... Search about changing textcolor and textbackground in c++ , and visit this link for an example :-
    https://pastebin.com/vP2p8KWR

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.