Computer Graphics Program source codes with full description.

Study of Various C Graphics Functions

Implementation and Using mouse in DOS

Implementation of DDA line algorithm with source code in C/C++.

Implementation of Bresenham Line algorithm with source code in C/C++.

Implementation of Midpoint Line algorithm with source code in C/C++.

Implementation of Bresenham Circle algorithm with source code in C/C++.

Implementation of Mid-point Circle algorithm with source code in C/C++.

Implementation of Mid-point Ellipse algorithm with source code in C/C++.

Implementation of Polygon Filling using Scan Fill with source code in C/C++.

Implementation of Polygon Filling using Flood Fill with source code in C/C++.

Implementation of Polygon Filling using Boundary Fill Algorithms.

Implementation of algorithm of 2D Transformation of an Object with source code in C/C++.

Implementation of Line Clipping using Cohen- Sutherland algorithm with source code in C/C++.

Implementation of Line Clipping using Liang-Barky algorithm with source code in C/C++.

Implementation of Polygon clipping using Sutherland-hodgeman algorithm with source code in C/C++.

Search

Friday 24 June 2011

Rail-Fence cipher encryption-decryption

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()

{
            int i,j=0,d,k=0;
            char p[50],ct[50][50];
            clrscr();
            printf("Enter the plain text:\n");
            gets(p);
            printf("\nEnter the depth in the integer:");
            scanf("%d",&d);
            //declare null for empty array values
            for(i=0;i<50;i++)
            {
                        for(j=0;j<50;j++)
                        {
                                    ct[i][j]='\0';
                        }
            }
            k=0;
       //loop up to string lenght of the pliantext
            {
            for(i=0;i<strlen(p);i++)
            {
                        for(j=0;j<d;j++)
                        {
                                    if(k<=strlen(p))
                               ct[i][j]=p[k];
                                    k++;
                        }
                        ct[i][j]='\0';


                        }
            }

            for(i=0;i<d;i++)
            {
                        for(j=0;j<strlen(p);j++)
                        {

                                    if(ct[j][i]!='\0')
                                       {
                                           printf("%c",ct[j][i]);
                                       }
                        }

                        printf("\n");
            }
            // Read the text
            printf("\nThe encrypted text is:\n");
            for(i=0;i<d;i++)
            {
                        for(j=0;j<strlen(p);j++)
                        {
                                    if(ct[j][i]!='\0')
                                    printf("%c",ct[j][i]);
                        }
            }

            getch();
}


output:

No comments:

Post a Comment

Copyright Text

Copyright @ LDRP Student Community, webmaster Rahul Bhadauriya