c++ basic program code example

Example 1: basic cpp programs

// Your First C++ Program

#include <iostream>

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

Example 2: cpp starting code

// A hello world program in C++

	#include<iostream>
	using namespace std;

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

Example 3: turbo c++ easy programs

#include<iostream.h>
#include<conio.h>
void main()
{
	clrscr();  // clear the screen
	cout<<"Hello Compiler, I am C++";
	getch();  // holds output screen until user press a key
}

Tags:

Cpp Example