Polealfabitli almashtirish shifrlash kodini c++ dasturini keltiramiz.
#include
#include
int main()
{ string kalit,matin, s1="", s2="", alifbo="", tayyor="";
cout << "BU DASTURDA INGLIZ TILI ALIBOSIDAN FOYDALANILGAN !" << endl;
cout << "KATTA HARFLARDA MATIN KIRITING !" << endl;
alifbo = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cout<<"kalit so'zni kiriting:"; cin>>kalit;
cout<<"matinni kiriting : "; cin >> matin;
int k=0;
for( int i=0; i < matin.length(); i++)
{
s1=alifbo;
if( k == kalit.length() ) k=0;
s2=s1.substr(s1.find(kalit.at(k))) + s1.substr(0,s1.find(kalit.at(k)));
tayyor += s2.at(alifbo.find(matin.at(i)));
k++;
}
cout<system("PAUSE");
return 0;
}
Polealfabitli almashtirish deshifrlash kodini c++ dasturini keltiramiz.
#include
#include
using namespace std;
int main()
{ string kalit,matin, s1="", s2="", alifbo="", tayyor="";
cout << "BU DASTURDA INGLIZ TILI ALIBOSIDAN FOYDALANILGAN !" << endl;
cout << "KATTA HARFLARDA MATIN KIRITING !" << endl;
alifbo = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cout<<"kalit so'zni kiriting:"; cin>>kalit;
cout<<"matinni kiriting : "; cin >> matin;
int k=0;
for( int i=0; i < matin.length(); i++)
{
s1=alifbo;
if( k == kalit.length() ) k=0;
s2=s1.substr(s1.find(kalit.at(k))) + s1.substr(0,s1.find(kalit.at(k)));
tayyor += s1.at(s2.find(matin.at(i)));
k++;
}
cout<return 0;
}
Do'stlaringiz bilan baham: |