First Project in C++





#include <iostream>
int main()
    std::cout << "Welcome to C++";
    return 0;

This is a simple C++ program that prints the message “Welcome to C++” to the console.

  • #include <iostream>: This line tells the compiler to include the header file iostream. This header file contains declarations for the standard input/output library.
  • int main(): This line defines the main function. The main function is the entry point for all C++ programs.
  • std::cout << “Welcome to C++”;: This line prints the message “Welcome to C++” to the console using the std::cout object.
  • return 0;: This line returns the value 0 from the main function. This indicates that the program terminated successfully.

When you compile and run this program, the following output will be printed to the console:

Welcome to C++

This is a very simple example of a C++ program, but it illustrates some of the basic concepts of the language, such as header files, functions, and input/output.

Share this

First Project in C++

Or copy link