c++ konsolenausgabe

To display output in C++, you can use the cout statement from the iostream library. Here's an example of how to use it:

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

Explanation:

  1. The #include <iostream> line includes the necessary header file for input and output operations.

  2. The int main() function is the entry point of the program. It is where the program execution begins.

  3. std::cout is an output stream object that is used to display output to the console.

  4. The << operator is used to insert data into the cout object. In this case, we are inserting the string "Hello, World!".

  5. std::endl is used to insert a newline character and flush the output buffer.

  6. Finally, return 0; is used to indicate that the program has executed successfully.

When you run this program, it will display "Hello, World!" in the console.