Sunday, 28 February 2016

Program To  Print Histogram of an Array Using C++

"Nice One Program"
#include<iostream.h>
#include<conio.h>
void main()
{
  clrscr();
  int a[6]={5,6,9,2,4,3};
  int g=a[0],i,j;

  for(i=1;i<6;i++)
  {  if(a[i]>g)
     g=a[i];      }


   for(i=0;i<9;i++)
 { cout<<"\n";
   for(j=0;j<6;j++)

 { if(a[j]<g)
  cout<<" ";
  else
  cout<<"*";   } g--;  }


 g=0;
  cout<<"\n";
 for(i=0;i<9;i++)
{ cout<<endl;
 for(j=0;j<6;j++)
  {   if(a[j]>=g)
      cout<<"*";
      else
      cout<<" ";
 }        g++;                 }




  getch();



  }

Saturday, 20 February 2016

Program To Print Array in the As "Asterisk"
By Column in C++

"Nice One Program"














#include<iostream.h>
#include<conio.h>
void main()
{
  clrscr();
  int a[6]={5,6,9,2,4,3};
  int i,j;

  char p[9][6];

  for(i=0;i<6;i++)
  for(j=0;j<9;j++)
{ if(j<(9-a[i]))
  p[j][i]='\0';
  else
  p[j][i]='*';

}

  for(j=0;j<9;j++)
 { cout<<endl;
  for(i=0;i<6;i++)
  cout<<p[j][i];

  }

  getch();


  }



Friday, 19 February 2016

Program To Find "PERMUTAION" of String in C++

"Nice One Program"

// Here Is The CODE for The program

//Observe it Carefully
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
int main()
{  char a[10],b[10],i,j;
   int l1,l2;
   clrscr();
   cout<<"PROGRAM TO CHECK PERMUTATION\n\n";

   cout<<"Enter The Original Word:-";
   cin>>a;
   cout<<"\nEnter The Word For checking Permutation:-\n\n";
   cin>>b;
   l1 = strlen(a);
   l2 = strlen(b);

   // HERE WILL  THE ACTUAL THING START

    if(l1!=l2)
   { cout<<"It Is NOT a Permutation Of Given Number\n";   }

    else

{ // sorting  for original
     int t1,t2;char t;

     for(i=0;i<l1;i++)
     for(j=0;j<l1-1-i;j++)
   {
       t1=a[j];
       t2=a[j+1];

       if(t1>t2)
      { t=a[j];
 a[j]=a[j+1];
 a[j+1]=t;
 }
   }


    //sorting Second one
    for(i=0;i<l1;i++)
    for(j=0;j<l1-1-i;j++)
    { t1=b[j];
      t2=b[j+1];
      if(t1>t2)
     {
       t=b[j];
       b[j]=b[j+1];
       b[j+1]=t;
     }
    }

   if(strcmp(a,b)==0)
   cout<<"\n\nYES IT IS A PERMUTAION OF GIVEN";
   else
   cout<<"\n\nIT IS NOT A PERMUTAION OF GIVEN";
}

   getch();    return 0;
     }


HERE ARE BOTH THE OUTPUTS:




















Wednesday, 17 February 2016

Program To Print "H" in C++

"""Nice One Program"""


Here is The Program To GiveYou The About

How To Print "H"  On the Screen.  User Will Enter The Value .And According to that

H will be Printed On the Screen

CODE:


#include<iostream.h>
#include<conio.h>

void main()
{ int n,i,j;     clrscr();

  cout<<"Enter The Number:";
  cin>>n;
  for(i=1;i<=3*n;i++)
{  for(j=1;j<=3*n;j++)

  if(j<=n||j>2*n)
  cout<<"*";
  else
  {if(i<=n||i>2*n)
   cout<<" ";
   else
  cout<<"*"; }
  cout<<endl;
  }

  getch();

  }





Add caption








Tuesday, 2 February 2016

My Lines

Chale The Kisi Se Wafa Karne

kYA Pta tha k

Khudd Se BeWAAFAI kR BAITHE GE
------------------------------------------------