C++ Program to Print Hello World With Escape Sequences

ad+1







Hello!

         Today i am going to code program in C++ to print hello world, and i will also print it using different escape sequences. Hope you will like it.




Simple Program:



    // Program By http://solutionscpp.blogspot.com
    // Author Mansoor Ahmed
    // GMail ID: secguy000@gmail.com

    #include<iostream>

    using namespace std;

    int main()
    {

       cout<<"Hello World" <<endl; 
       return 0;
    }


Output:


    Hello World




With Escape Sequences


 // Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com

#include<iostream>

using namespace std;

int main()

{

   cout<<"Hello\nWorld" <<endl;       //it will print Hello World in seperate lines                       

   cout<<"Hello \t World" <<endl;    //it will print Hello World with a space of 1 tab

   cout<<"\' Hello World \' " <<endl;  //it will print Hello World in single quotes

   cout<<"\" Hello World \" "<<endl;    //it will print Hello World in double quotes

   cout<<"\\ Hello World \\ " <<endl;   //it will print Hello World in Backslash

   return 0;
}


Output:


    Hello
    World
    Hello      World
    ' Hello World '
    " Hello World "
    \ Hello World \





3 comments: Leave Your Comments

  1. This is nice blog. Contents over here are so informative. For more on this topic, have a look here.. Escape sequence – Object Oriented Programming (OOP)

    ReplyDelete
  2. I even managed to write such a program and every time hello world is the one where it starts. Recently, when I clicked on the link, I got to know a completely new release of applications that work in the cloud. I have to admit that they are used very intuitively.

    ReplyDelete