CODE FOR QUICKSORT IN DATA STRUCTURE
Thursday, 22 September 2016
Program To Find Nth Prime Number And Print On The Screen.
"Nice One Program"
#include<iostream.h>
#include<conio.h>
int main()
{ clrscr();
int i,j,f=1,c=1,n,a[1000];
a[0]=2;
for(i=3;i<=1000;i++)
{ for(j=2;j<i;j++)
{ if(i%j==0)
{ f=0;break;}
}
if(f)
a[c++]=j;
else
f=1;
}
cout<<"\nEnter which prm numbr:";
cin>>n;
cout<<a[n-1];
getch();
}
"Nice One Program"
#include<iostream.h>
#include<conio.h>
int main()
{ clrscr();
int i,j,f=1,c=1,n,a[1000];
a[0]=2;
for(i=3;i<=1000;i++)
{ for(j=2;j<i;j++)
{ if(i%j==0)
{ f=0;break;}
}
if(f)
a[c++]=j;
else
f=1;
}
cout<<"\nEnter which prm numbr:";
cin>>n;
cout<<a[n-1];
getch();
}
Monday, 18 April 2016
Pangram Checker
Pangram-is a word or Phrase which have all the Alphabets from a to z in it.
"Nice One Program"
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()
{ clrscr();
char s[100]; int l,i=0,j,f=0;
cout<<"Enter The String For Checking:\n\n";
cin.getline(s,100);
l=strlen(s);
int t;
cout<<l<<endl;
while(s[i])
{
s[i]=tolower(s[i]);
i++;
}
cout<<s;
for(i=97;i<122;i++)
{ for(j=0;j<l;j++)
{ t=s[j];
if(s[j]=='\0')
f=0;
else if(t==i)
f=1;
}
if(f==0)
break;
}
if(f==1)
cout<<"\n\nPANGRAM";
else
cout<<"\n\nNOT PANGRAM";
getch();
}
Pangram-is a word or Phrase which have all the Alphabets from a to z in it.
"Nice One Program"
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()
{ clrscr();
char s[100]; int l,i=0,j,f=0;
cout<<"Enter The String For Checking:\n\n";
cin.getline(s,100);
l=strlen(s);
int t;
cout<<l<<endl;
while(s[i])
{
s[i]=tolower(s[i]);
i++;
}
cout<<s;
for(i=97;i<122;i++)
{ for(j=0;j<l;j++)
{ t=s[j];
if(s[j]=='\0')
f=0;
else if(t==i)
f=1;
}
if(f==0)
break;
}
if(f==1)
cout<<"\n\nPANGRAM";
else
cout<<"\n\nNOT PANGRAM";
getch();
}
Tuesday, 15 March 2016
Program To Print The Mirror Image of an Array in C++
"Nice One Program"
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a[7][7]; int r,col;
cout<<"Enter The number Of Rows and Columns:";
cin>>r;
cout<<endl;
cin>>col;
cout<<"\n\n";
cout<<"Enter The Elements Row wise\n";
int i,j;
for(i=0;i<r;i++)
for(j=0;j<col;j++) //Array Input
cin>>a[i][j];
cout<<"\n\n";
for(i=0;i<r;i++)
{ cout<<endl;
for(j=0;j<col;j++)
cout<<a[i][j]<<" "; //Printing Original
cout<<"-->";
for(j=col-1;j>=0;j--) //Printing Mirror Img
cout<<a[i][j]<<" ";
}
getch();
}
"Nice One Program"
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a[7][7]; int r,col;
cout<<"Enter The number Of Rows and Columns:";
cin>>r;
cout<<endl;
cin>>col;
cout<<"\n\n";
cout<<"Enter The Elements Row wise\n";
int i,j;
for(i=0;i<r;i++)
for(j=0;j<col;j++) //Array Input
cin>>a[i][j];
cout<<"\n\n";
for(i=0;i<r;i++)
{ cout<<endl;
for(j=0;j<col;j++)
cout<<a[i][j]<<" "; //Printing Original
cout<<"-->";
for(j=col-1;j>=0;j--) //Printing Mirror Img
cout<<a[i][j]<<" ";
}
getch();
}
Thursday, 3 March 2016
Ceaser Cipher Program in C++
"Nice One Program"
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()
{ clrscr();
int choice,l;
char a[10];
cout<<"Enter Choice:\nCODING:1\nDECODING:2\nChoice:";
cin>>choice;
int i,t;
if(choice==1)
{ cout<<"Enter Object:";
cin>>a;
l=strlen(a);
for(i=0;i<l;i++)
a[i]=toupper(a[i]);
for(i=0;i<l;i++)
{ t=a[i];
if(t==90)
{ a[i]=67;
cout<<a[i]<<" ";
}
else if(t==89)
{a[i]=66;
cout<<a[i]<<" ";
}
else if(t==88)
{a[i]=65;
cout<<a[i]<<" ";
}
else
{ a[i]=t+3;
cout<<a[i]<<" ";
}
}
}//END Of Coding
else if(choice==2)
{cout<<endl<<"Enter The CODED Form:";
cin>>a;
l=strlen(a);
for(i=0;i<l;i++)
a[i]=toupper(a[i]);
for(i=0;i<l;i++)
{ t=a[i];
if(t==65)
{ a[i]=88;
cout<<a[i]<<" ";
}
else if(t==66)
{ a[i]=89;
cout<<a[i]<<" ";
}
else if(t==67)
{ a[i]=90;
cout<<a[i]<<" ";
}
else
{ a[i]=t-3;
cout<<a[i]<<" ";
}
}
}// END OF DECODER
getch();
}
"Nice One Program"
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()
{ clrscr();
int choice,l;
char a[10];
cout<<"Enter Choice:\nCODING:1\nDECODING:2\nChoice:";
cin>>choice;
int i,t;
if(choice==1)
{ cout<<"Enter Object:";
cin>>a;
l=strlen(a);
for(i=0;i<l;i++)
a[i]=toupper(a[i]);
for(i=0;i<l;i++)
{ t=a[i];
if(t==90)
{ a[i]=67;
cout<<a[i]<<" ";
}
else if(t==89)
{a[i]=66;
cout<<a[i]<<" ";
}
else if(t==88)
{a[i]=65;
cout<<a[i]<<" ";
}
else
{ a[i]=t+3;
cout<<a[i]<<" ";
}
}
}//END Of Coding
else if(choice==2)
{cout<<endl<<"Enter The CODED Form:";
cin>>a;
l=strlen(a);
for(i=0;i<l;i++)
a[i]=toupper(a[i]);
for(i=0;i<l;i++)
{ t=a[i];
if(t==65)
{ a[i]=88;
cout<<a[i]<<" ";
}
else if(t==66)
{ a[i]=89;
cout<<a[i]<<" ";
}
else if(t==67)
{ a[i]=90;
cout<<a[i]<<" ";
}
else
{ a[i]=t-3;
cout<<a[i]<<" ";
}
}
}// END OF DECODER
getch();
}
PLEASE COMMENT DOWN FOR ANY PROBLEM REGARDING CODE
WE WILL SURELY HELP YOU.. THANK YOU FOR VISITING
KEEP VISITING FOR MORE QUESTIONS AND THEIR CODES.
Please Share This Page...
WE WILL SURELY HELP YOU.. THANK YOU FOR VISITING
KEEP VISITING FOR MORE QUESTIONS AND THEIR CODES.
Please Share This Page...
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();
}
"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();
}
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:
"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();
}
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
------------------------------------------------
kYA Pta tha k
Khudd Se BeWAAFAI kR BAITHE GE
------------------------------------------------
Subscribe to:
Posts (Atom)