C++语言开发示例:20. 比较字符串

2024-07-13 16:20:43 2025-02-01 20:27:13 李腾 23 次阅读 0 次点赞

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;
}
本文由人工编写,AI优化,请仔细甄别,转载请注明转自www.hylab.cn,原文地址:C++语言开发示例:20. 比较字符串

评论 (0)

登录后发表评论

暂无评论,快来发表第一条评论吧!