0
= BEKKAMOV FAYZI
Dastur kodi:
#include
#include
using namespace std;
int main() {
char s1[50],s2[50];int k;
cout<<"Shifrlash:"<
cout<<"Satrni kiriting:";
cin.getline(s1,sizeof(s1));
cout<<"Kalitni kiriting:K=";cin>>k;
for(int i=0;s1[i]!='\0';i++){
if((int)s1[i]>=65 and (int)s1[i]<=90){
if((int)s1[i]+k>90)s2[i]=(int)s1[i]+k-26;
else s2[i]=(int)s1[i]+k;}
else if((int)s1[i]>=97 and (int)s1[i]<=122){
if((int)s1[i]+k>122)s2[i]=(int)s1[i]+k-26;
else s2[i]=(int)s1[i]+k;}}
for(int i=0;i<=strlen(s2)-1;i++)
cout<
cout<<"Deshifrlash:"<
for(int i=0;s2[i]!='\0';i++){
if((int)s2[i]>=65 and (int)s2[i]<=90){
if((int)s2[i]-k<65)s1[i]=(int)s2[i]-k+26;
else s1[i]=(int)s2[i]-k;}
else if((int)s2[i]>=97 and (int)s2[i]<=122){
if((int)s2[i]-k<97)s1[i]=(int)s2[i]-k+26;
else s1[i]=(int)s2[i]-k;}}
cout<
return 0;}
Dastur natijasi:
Topshiriq:
1. Har bir talaba Familiya ismini lotin alifbosi jadvalidan foydalanib shifrlaydi,
deshifrlaydi va shunga mos dastur tuzadi. Talaba uchun jurnaldagi tartib raqami kalit
(K) hisoblanadi.
Do'stlaringiz bilan baham: |