close

//---------------------------------------------------------------------------
#include <iostream>
#include <cstring>
//---------------------------------------------------------------------------
char first[100];
char last[100];
char full_name[100];

int main(int argc, char* argv[])
{
        std::strcpy(first, "Steve");
        std::strcpy(last, "Oualline");

        std::strcpy(full_name, first); // full = "Steve"
        std::strcat(full_name, " ");   // full = "Steve "
        std::strcat(full_name, last);  // full = "Steve Oualline"
        std::cout << "The full name is " << full_name << '\n';
        std::system("pause");
        return 0;
}
//---------------------------------------------------------------------------

此程式的輸出是:
The full name is Steve Oualline


題目來源:C++風格與藝術 第二版 Steve Oualline 著 黃吉霈 編譯


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jumbowind 的頭像
    jumbowind

    Quality of life is not what you get but what you become

    jumbowind 發表在 痞客邦 留言(0) 人氣()