c++
本蒟蒻在写潜伏者时不知为何报错
代码:
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
map<char,char>m;
map<char,int>c;
map<char,int>d;
char a[10000],b[10000],s[10000],k[10000];
int main(){
char s[14],c;
cin>>a>>b;
int u=strlen(a) ;
for(int i=0;i<u;i++){
if(!c[a[i]]&&!d[b[i]]){
m[b[i]]=a[i];
c[a[i]]=1;
d[b[i]]=1;
}else{
cout<<"Failed";
return 0;
}
}
cin>>s;
int o=strlen(s) ;
for(int i=0;i<o;i++){
if(d[s[i]]){
k[i]=m[s[i]];
}else{
cout<<"Failed";
return 0;
}
}
return 0;
}
报错:
C:\未命名1.cpp In function 'int main()':
15 13 C:\未命名1.cpp [Error] invalid types 'char[char]' for array subscript
17 10 C:\未命名1.cpp [Error] invalid types 'char[char]' for array subscript