You are here

C++ hello world program

C++ hello world program: C++ programming code to display hello world on screen.

C++ hello world example

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

C++ hello world class program

#include<iostream>
 
using namespace std;
 
// Creating class
 
class Message
{
  public:
 
    void display() {
      cout << "Hello World\n";
    }
};
 
int main()
{
	Message c;    // Creating object
	c.display();  // Calling function
 
	return 0;
}