知识库

C++语言开发示例:02. while循环

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

while.cpp

#include <iostream>

const int ArSize = 20;

int main()
{
    using namespace std;
    char name[ArSize];
    cout << "Your first name, please: ";
    cin >> name;
    cout << "Here is your name, verticalized and ASCIIized:\n";
    int i = 0;
    while (name[i] != '\0')
    {
        cout << name[i] << ": " << int(name[i]) << endl;
        i++;
    }
}
转载请注明转自www.hylab.cn,原文地址:C++语言开发示例:02. while循环

评论 (0)

登录后发表评论

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