-1
比方说,我有一个数组将字符串数组放入参数中,然后将元素与文字字符串错误进行比较?
string test = {"test1, "test2"}
我有我的功能
void testing(string test){
for(int i = 0; i < 2; i++){
if(test[i] == "test1"){
cout << "success" << endl;
}
}
}
但是,当我编译此,我得到一个错误......这是为什么? 有没有不同的方法?
'字符串测试'看起来不像一个数组。它看起来像'string'。 – juanchopanza
'string test'中缺少''''test1'。 – shruti1810