如何用下划线替换字符串?

时间:2016-02-11 00:31:13

标签: c++ string replace

我正在尝试使用此代码,但它无法正常工作

for(int i = 0; i < message_length; i++){
        char y = message[i];    

        if(y == '_'){
            cout << " ";
            }
        if(y != '_' && player_choice != y && guessed_letters[i] != y){
            cout << "-";
            }
        if(y != '_' && player_choice == y && guessed_letters[i] != y){
            cout << player_choice;
            }

        if(y != '_' && player_choice == y && guessed_letters[i] == y){
            cout << guessed_letters[i];
            }
}

0 个答案:

没有答案