C++ Hello World Program – A Beginner’s Guide

Filed Under: C++
C Hello! World Program

Hello, readers! In this article, we will be focusing on Writing a C++ Hello World Program. So, let us begin with the explanation now!


Introduction to C++ language

C++ is a powerful Object-Oriented Programming language. It deals with classes and objects to represent the attributes and behavior of an entity.

Moreover, it is an extension of C language, with various functionalities added to it such as:

  • OOP Paradigm
  • friend function
  • virtual function
  • Feasible for application development, etc.

So, now let us begin with the basic program of Printing a C++ ‘Hello! World’ Program on console.


Implementing Hello World in C++

Let us start with the implementation of Hello World in C++.

In the very beginning, we need to mention the required header files to provide the given program with the basic functions of input and output.

The header file ‘iostream‘ is the header file that provides the input/output functionalities to the program.

#include <iostream>

Further, we use the Namespace standard to include all the type definitions in the scope of the current developing program.

using namespace std;

Now, comes the main execution area of the code. Every C++ code execution starts with the main() function. It returns an integer value to show the successful execution of the code.

int main(){
//body
}

In order to print ‘Hello! World’, we use cout statement in C++ that prints the user defined data on the screen/console. cout is the ostream object that prints the output to the screen.

 cout << "Hello! World";

The statement return(0) terminates the program and implicates a successful execution of the code.

return 0;

C++ Hello World Code

Please find below the entire code to print ‘Hello! World’ in C++

#include <iostream>
using namespace std;
int main() {
   cout << "Hello! World";
   return 0;
}

Conclusion

By this, we have come to the end of this topic. Feel free to comment below, in case you come across any question!

For more such posts related to C++ programming, do visit C++ tutorials with JournalDev.

Till then, Happy Learning!!


References

Comments

  1. Sulochana says:

    It’s very nice…we want more from this .com

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages