Objective:

Write a C++ program that prints “Hello, World!” to the console.

Task:

  1. Write a simple C++ program that outputs “Hello, World!”.
  2. Use the cout command to display the message.

Code:

#include <iostream>
using namespace std;

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

Explanation:

  • This is a basic C++ program that uses the cout statement to print “Hello, World!” to the console.
  • The endl command moves the output to the next line.

Expected Output:

Hello, World!