20. 比较字符串

创建日期:2024-07-13
更新日期:2025-02-01

compstr1.cpp

#include <iostream>
#include <cstring>

int main()
{
    using namespace std;
    char word[5] = "?ate";
    for (char ch = 'a'; strcmp(word, "mate"); ch++)
    {

        cout << word << endl;
        word[0] = ch;
    }
    cout << "After loop ends, word is " << word << endl;
}