Home » Source Code C++

Sandi Viginer

4 May 2008 49 views 0 Komentar
#include<iostream.h>
#include<string.h>
#include<iomanip.h>
 
void main()
{
char choice, again;
char input1[50],lock1[50];
int p1,q1,jum_k1,jum_m1,hrf1_k=0,hrf1_m=0,
ubh_k1[50],ubh_m1[50],ubh_h1[50];
char input2[50],lock2[50];
int p2,q2,jum_k2,jum_m2,hrf2_k=0,hrf2_m=0,
ubh_k2[50],ubh_m2[50],ubh_h2[50];
 
 
cout << endl;
cout << "|===============================================================|" << endl ;
cout << "|===============================================================|" << endl ;
cout << "|======================VIGENER CODE PROGRAM=====================|" << endl ;
cout << "|===============================================================|" << endl ;
cout << "|===============================================================|" << endl ;
cout << "\t\t\t\tBy :" << endl ;
cout << "\t\t1. Ahmad Nasrullah Jamaludin" << endl ;
cout << "\t\t2. Laily Aminatus Sholikhah" << endl ;
cout << "\t\t3. Wiwid Sofianti Budiono" << endl ;
cout << endl;
cout << "Choice:" << endl ;
cout << "1. Convert simple sentences to vigener code whitout space" << endl;
cout << "2. Convert vigener code to simple sentences whitout space" << endl;
cout << endl ;
cout << "CAUTION: " << endl ;
cout << "Before run this program, the keyboard must CAPS LOCK condition" << endl ;
 
back :
cout << endl ;
cout << "Enter your choice: " ;
cin >> choice ;
if (choice=='1')
{
cout << endl ;
cout << "==============================================" << endl ;
cout << " CONVERT SIMPLE SENTENCES TO VIGENER CODE " << endl ;
cout << " Without Space " << endl ;
cout << "==============================================" << endl ;
cout << setiosflags(ios::left) << setw(20)
<< "Enter lock word" << ": " ;
cin >> lock1;
for (int r1=0;lock1[r1];r1++)
{
if ((lock1[r1]>='a')&&(lock1[r1]<='z'))
hrf1_k++ ;
}
jum_k1=strlen(lock1) ;
for (p1=0,q1=jum_k1;p1<jum_k1,q1<50;p1++,q1++)
{
lock1[q1]=lock1[p1] ;
if (p1==(jum_k1-1))
p1=-1 ;
if (q1==50)
break ;
}
cout << setiosflags(ios::left) << setw(20)
<< "Enter sentences" << ": " ;
cin >> input1 ;
for (int s1=0;input1[s1];s1++)
{
if ((input1[s1]>='a')&&(input1[s1]<='z'))
hrf1_m++ ;
}
jum_m1=strlen(input1) ;
for (int x1=0;x1<jum_m1;x1++)
{
ubh_k1[x1]=(int)lock1[x1] ;
ubh_m1[x1]=(int)input1[x1] ;
ubh_h1[x1]=(ubh_m1[x1]-65)+ubh_k1[x1] ;
}
if (hrf1_k>=1||hrf1_m>=1)
{
cout << endl ;
cout << "Sorry your lock word or sentences is wrong" << endl ;
cout << endl ;
cout << "URGENT:\n" ;
cout << "Lock word must be capital word\n" ;
}
else
{
cout << setiosflags(ios::left) << setw(20)
<< "Code" << ": " ;
for (x1=0;x1<jum_m1;x1++)
{
if (ubh_h1[x1]<=90)
cout << (char)ubh_h1[x1] ;
else
cout << (char)(ubh_h1[x1]-26) ;
}
cout << endl ;
}
}
 
 
else if (choice=='2')
{
cout << endl ;
cout << "==============================================" << endl ;
cout << " CONVERT VIGENER CODE TO SIMPLE SENTENCES " << endl ;
cout << " Without Space " << endl ;
cout << "==============================================" << endl ;
cout << setiosflags(ios::left)<<setw(23)
<< "Enter lock word" << ": " ;
cin >> lock2 ;
for (int r2=0;lock2[r2];r2++)
{
if ((lock2[r2]>='a')&&(lock2[r2]<='z'))
hrf2_k++ ;
}
jum_k2=strlen(lock2) ;
for (p2=0,q2=jum_k2;p2<jum_k2,q2<50;p2++,q2++)
{
lock2[q2]=lock2[p2] ;
if (p2==(jum_k2-1))
p2=-1 ;
if (q2==50)
break ;
}
cout << setiosflags(ios::left) << setw(23)
<< "Enter code" << ": " ;
cin >> input2 ;
for (int s2=0;input2[s2];s2++)
{
if ((input2[s2]>='a')&&(input2[s2]<='z'))
hrf2_m++ ;
}
jum_m2=strlen(input2) ;
for (int x2=0;x2<jum_m2;x2++)
{
ubh_k2[x2]=(int)lock2[x2] ;
ubh_m2[x2]=(int)input2[x2] ;
ubh_h2[x2]=(ubh_m2[x2]-ubh_k2[x2])+65 ;
}
if (hrf2_k>=1||hrf2_m>=1)
{
cout << endl ;
cout << "Sorry your lock word or sentences is wrong\n" ;
cout << endl;
cout << "URGENT:\n" ;
cout << "Lock word must be capital word\n" ;
}
else
{
cout << setiosflags(ios::left) << setw(23)
<< "Simple Sentences" << ": " ;
for (x2=0;x2<jum_m2;x2++)
{
if (ubh_h2[x2]>=65)
cout << (char)ubh_h2[x2] ;
else
cout << (char)(ubh_h2[x2]+26) ;
}
cout << endl ;
}
}
 
 
else
cout<<"Sorry your choice is not valid" << endl ;
 
back2:
cout << endl ;
cout << "Do you want to use this program again? <y/n>" << endl ;
cin >> again ;
if (again=='Y'||again=='y')
goto back ;
else if (again=='N'||again=='n')
{
cout << endl;
cout << "\t\t\tTHANK YOU" << endl;
}
else
goto back2 ;
 
}

WP Text Ads Ingin pasang iklan baris di Jembelisme Media! Klik di sini

Tinggalkan Komentarmu!

Tulis komentarmu di bawah, atau trackback dari websitemu. Kamu juga dapat berlangganan komentar ini via RSS.

Kamu dapat menggunakan tag-tag berikut:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

Website ini support dengan Gravatar Image. Untuk register silahkan kunjungi situs Gravatar.