• Technology News

    Linked List in c++

    #include<stdio.h> #include<conio.h> #include<iostream.h> #include<dos.h> void insert_beg(); void insert_end(); void del(); void display(); void options(); struct node { int info; struct node *link; }; struct node *start,*temp,*ptr; int data; void main() { clrscr(); start=NULL; options(); getch(); } void options() { clrscr(); cout<<”Press 1 for insertion at the begining “; cout<<”\nPress 2 for insertion at the end…

  • Technology News

    Playfair program in c++

    #include<conio.h> #include<iostream.h> #include<string.h> void encrypt(char first,char second,int j); void decrypt(char first,char second,int j); int check(char z); int k=0,ch=97,ki=0,i=0,j,p,h; char key[20], a[5][5],alp[26],s,ct[20],dt[20]; void main() { clrscr(); while(i<26) { alp[i]=97+i; i++; } cout<<”Enter key “; cin>>key; int klen=strlen(key); for(i=0;i<5;i++) { for(j=0;j<5;j++) { if(k<klen) { s=key[k]; k++; } else { s=alp[h]; h++; } p=check(s); if(p==0) { a[i][j]=s; }…

  • Technology News

    Caesar Cipher program in c++

    #include<conio.h> #include<iostream.h> #include<string.h> void main() { clrscr(); char msg[20],c[20],cipher[20]; int key,test; cout<<”Enter plain text “; cin>>msg; cout<<”Enter key “; cin>>key; for(int i=0;i<strlen(msg);i++) { c[i]=msg[i]+key; test=c[i]; if(test>=122) { test=test-26; cipher[i]=test; cout<<char(test); //<<test<<” “; } else { cipher[i]=c[i]; cout<<c[i]; //<<int(c[i])<<” “; } } cipher[i]=’\0′; cout<<”\n cipher text : “<<cipher; //decrypytion cout<<”\nDecryption\n”; for(i=0;i<strlen(msg);i++) { c[i]=cipher[i]-key; test=c[i]; if(test<=97) {…

  • Technology News

    RSA Program in c++

    #include<conio.h> #include<iostream.h> #include<math.h> int gcd(int r1,int r2); void main() { clrscr(); long int p,q,n,phin,e; cout<<”Enter p : “; cin>>p; cout<<”enter q : “; cin>>q; n=p*q; cout<<” n : “<<n; phin=(p-1) * (q-1); long int g; for(e=2;e<200;e++) { g=gcd(phin,e); if(g==1) break; } cout<<”\n E : “<<e; long int d,dd; for(d=2;d<200;d++) { dd=d*e; if(dd%phin==1) { break; }…

  • Technology News

    Extended Eucledean Program in c++

    #include<conio.h> #include<iostream.h> void main() { clrscr(); int rem,r1,r2,s1=1,s2=0,s,t1=0,t2=1,t,q; cout<<”Enter r1 : “; cin>>r1; cout<<”Enter r2 : “; cin>>r2; while(rem!=0) { q=r1/r2; rem=r1%r2; s=s1-(q*s2); t=t1-(q*t2); cout<<”R1 : “<<r1; cout<<” R2 : “<<r2; cout<<” REM : “<<rem; cout<<” s1 : “<<s1; cout<<” s2 : “<<s2; cout<<” s : “<<s; cout<<” t1 : “<<t1; cout<<” t2 : “<<t2;…

  • Technology News

    Eucledean Program in c++

    #include<conio.h> #include<iostream.h> void main() { clrscr(); int rem,r1,r2; cout<<”Enter r1 : “; cin>>r1; cout<<”Enter r2 : “; cin>>r2; while(rem!=0) { rem=r1%r2; cout<<”R1 : “<<r1; cout<<” R2 : “<<r2; cout<<” REM : “<<rem; cout<<”\n”; if(rem==0) break; r2=rem; r1=r2; } cout<<”R2 is : “<<r2; getch(); }

  • Technology News

    Binary Search Tree

    #include #include #include struct bstnode { int data; struct bstnode *left; struct bstnode *right; }; struct bstnode *root=NULL,*loc,*par,*temp,*ptr,*save; int element,n,i; struct bstnode* insert(struct bstnode* root,int element) { if(root==NULL) { root=new bstnode; root->left=NULL; root->right=NULL; root->data=element; return root; } else { if(elementdata) { root->left=insert(root->left,element); } else { if(element>root->data) { root->right=insert(root->right,element); } else { cout

  • Technology News

    Insertion Sort in c++

    #include<conio.h> #include<iostream.h> void main() { clrscr(); int a[20],i,j,temp,size,ptr; cout<<”Enter the size of array “; cin>>size; cout<<”Enter the elements in array “; for(i=1;i<=size;i++) cin>>a[i]; a[0]=0; for(i=2;i<=size;i++) { temp=a[i]; ptr=i-1; while(temp<a[ptr]) { a[ptr+1]=a[ptr]; ptr–; } a[ptr+1]=temp; cout<<a[1]<<” “<<a[2]<<” “<<a[3]<<” “<<a[4]<<” “<<a[5]<<endl; } cout<<”\n\n\nAfter insertion “; for(i=1;i<=size;i++) { cout<<a[i]<<endl; } getch(); }

  • Technology News

    Radix Sort Program in c++

    #include<stdio.h> #include<conio.h> #include<iostream.h> void main() { clrscr(); int sorted[10],k=0; int size,arr[20],i,j ; int bucket[10][10],temparr[20];; cout<<”Enter size of array “; cin>>size; cout<<”Enter elements in array “; for(i=0;i<size;i++) { cin>>arr[i]; }   //find the largest int largest=arr[0]; for(i=1;i<size;i++) { if(arr[i]>largest) { largest=arr[i]; } } cout<<”\nLargest no. is “<<largest; //no. of digits in largest int count=0; while(largest>0) {…