密钥加密问题

密钥加密问题_第1张图片

C++参考代码:

#include
#include
#include
using namespace std;
int main()
{
	vector x;
	vector y;
	map word;
	char ch = getchar();
	getchar();
	string str;
	getline(cin,str);
	for(char c=ch;c<='Z';c++){
		y.push_back(c);
	}
	for(char c='A';c(x[i],y[i]));
	}
	for(int i=0;i='A'&&str[i]<='Z'){
			cout<

 Java参考代码:

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      Map map = new HashMap();
      ArrayList word = new ArrayList<>();
      String key = scan.nextLine();
      String essay = scan.nextLine();
      for(char ch = key.charAt(0);ch<='Z';ch++) word.add(ch);
      for(char ch = 'A';ch='A'&&essay.charAt(i)<='Z') System.out.print(map.get(essay.charAt(i)));
    	  else System.out.print(essay.charAt(i));
      }
      scan.close();
    }
}

你可能感兴趣的:(Java期末复习专栏,基础编程题目,java,数据结构,安全,c++)