知识库

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

2025-02-01 20:27:34 李腾 1 次阅读

compstr2.cpp

#include <iostream>
#include <string>

int main()
{
    using namespace std;
    string word = "?ate";
    for (char ch = 'a'; word != "mate"; ch++)
    {

        cout << word << endl;
        word[0] = ch;
    }
    cout << "After loop ends, word is " << word << endl;
}
转载请注明转自www.hylab.cn,原文地址:C++语言开发示例:01. 字符串比较

评论 (0)

登录后发表评论

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