"C++ 문자열"의 두 판 사이의 차이

22번째 줄: 22번째 줄:
     cout << "s[2]=" << s[2] << endl;
     cout << "s[2]=" << s[2] << endl;
     cout << "s[3]=" << s[3] << endl;
     cout << "s[3]=" << s[3] << endl;
    cout << "s[4]=" << s[4] << endl;
    cout << "s[5]=" << s[5] << endl;
    cout << "s[6]=" << s[6] << endl;
     cout << "done..." << endl;
     cout << "done..." << endl;
}
}

2024년 1월 15일 (월) 19:57 판

1 개요

C++ string
C++ 문자열
#include <iostream>
using namespace std;

int main() {
    string s = "foo";
    cout << s.length(); // 3
}
#include <iostream>
using namespace std;

int main() {
    string s = "foo";
    cout << "s[0]=" << s[0] << endl;
    cout << "s[1]=" << s[1] << endl;
    cout << "s[2]=" << s[2] << endl;
    cout << "s[3]=" << s[3] << endl;
    cout << "s[4]=" << s[4] << endl;
    cout << "s[5]=" << s[5] << endl;
    cout << "s[6]=" << s[6] << endl;
    cout << "done..." << endl;
}

2 멤버 함수

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}