c++可实现的代码块

using namespace std;

int main(){
    char s[1002];
    char c;
    cin.get(s,1001);
    cin>>c;
    int num=0, i=0;
    while(i<=strlen(s)){
        if(s[i]==c||toupper(s[i])==c||tolower(s[i])==c)num++;
        i++;
    }
    cout<<num;
    return 0;
}