Skip to main content

Pattern dimondHollow C++

        * 

      *   * 

    *       * 

  *           * 

*               * 

  *           * 

    *       * 

      *   * 

        * 


#include<iostream>
using namespace std;

int main()
{
      for(int i=0;i<9;i++)
    {  
        if(i<5){
       for(int j=0;j<=(2*i+4-i);j++)
        {
            if(j==(4-i) || j==(2*i+4-i))
            cout<<"* ";
            else
            cout<<"  ";
        }
        }
       
        else
        {
         
           for(int j=0;j<=(12-i);j++)
        {
            if(j==(i-4) || j==(12-i))
            {
                cout<<"* ";
            }
         
            else
            cout<<"  ";
        }
        }
        cout<<endl;
    }
    return 0;

}



Comments

Popular posts from this blog

7 features of OOPs

The 7 features of OOPs are as follows: 1. Incapsulation 2. Abstraction 3. Inheritance 4. Polymorphism 5. Object must be used 6. Massage passing : One object can interect with another object 7. Dynamic binding The most initial 4 are the basic OOPs features that is required.

SQL COMMANDS CHEAT SHEET

DDL (Data Definition Language) DDL  or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database. DDL is a set of SQL commands used to create, modify, and delete database structures but not data. These commands are normally not used by a general user, who should be accessing the database via an application. List of DDL commands:  CREATE : This command is used to create the database or its objects (like table, index, function, views, store procedure, and triggers). DROP : This command is used to delete objects from the database. ALTER :  This is used to alter the structure of the database. TRUNCATE :  This is used to remove all records from a table, including all spaces allocated for the records are removed. COMMENT : This is used to add comments to the data dictionary. RENAME :...

Array Data Structure