密码学作业,维吉尼亚密码的代码实现
#include<bits/stdc++.h> using namespace std; int main() { int cnt1=0,cnt2=0; string s; string a,temp1,temp2; getline(cin,s); getline(cin,a); int c=a.size(); for(int j=0;j<s.size();j++) { int temp=(int)s[j]; if(temp>=64&&temp<=90) { temp+=(a[cnt1%c]-'A'); while(temp>90) temp-=26; cnt1++; } else if(temp>=97&&temp<=122) { temp+=(a[cnt1%c]-'a'); while(temp>122) temp-=26; cnt1++; } temp1+=(char)temp; } cout<<temp1<<endl; return 0; }
感谢观看喵

浙公网安备 33010602011771号