为什么我必须初始化数组?

时间:2019-12-30 12:01:21

标签: arrays string brute-force

string s; int o = 0;
    cin >> s;
    char s1[100] = {0};
    for (int i = 0; i < s.length(); i++) {
        for (int r = 0; r < s.length(); r++) {
            if (s[i] == s1[r]) {
                o--;
                break;
            }
        }
        s1[i] = s[i];
        o++;
    }
    if (o % 2 == 0) {
        cout << "CHAT WITH HER!";
    }
    else {
        cout << "IGNORE HIM!";
    }

这是我的代码,当我不初始化数组不起作用时,但是当我起作用时却不明白为什么! https://codeforces.com/problemset/problem/236/A

0 个答案:

没有答案