Issuu on Google+

THE UNIVERSITY OF DODOMA

College Of Informatics and Virtual Education

NAME: Makame, Makame H REGISTRATION No: T/UDOM/2010/00410 PROGRAM: B Sc. Computer and Information Security

ASSIGNMENT NO.2

COURSE NAME: Introduction to IT Security

COURSE CODE: IS 102 COUSE INSTRUCTOR: Florence Rashidi

Question: Write a C++ program that convert plain text to cipher text.

Tuesday, August 16, 2011


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

void main() { char alpher[]="abcdefghijklmnopqrstuvwxyzabc ABCDEFGHIJKLMNOPQRSTUVWXYZABC"; char cipher[50]; char word[30];

cout<<" Enter your plain text"<<endl<<endl<<"\t"; cin.get(word,30); int k=3; int i=0;

while(word[i]!='\0') { for(int e=0;e<59;e++) { if(word[i]==alpher[e]) { cipher[i]=alpher[e+k]; e=60; } } i++; }

Tuesday, August 16, 2011


cout<<"\n The coresponding Cipher text is "<<endl <<endl<<"\t"; int o=0; while(cipher[o]!='\0') { cout<<cipher[o]; o++; } endl; getch(); } Output:

Tuesday, August 16, 2011


Converting plain text to cipher text