"C++ 벡터 벡터"의 두 판 사이의 차이

(새 문서: ==개요== ;C++ 벡터 벡터 ;C++ 2차원 벡터 <syntaxhighlight lang='cpp'> #include <iostream> #include <vector> using namespace std; int main() { vector<vector<int>> v = {{...)
 
3번째 줄: 3번째 줄:
;C++ 2차원 벡터
;C++ 2차원 벡터


<syntaxhighlight lang='cpp'>
<syntaxhighlight lang='cpp' run>
#include <iostream>
#include <iostream>
#include <vector>
#include <vector>

2024년 1월 7일 (일) 01:05 판

1 개요

C++ 벡터 벡터
C++ 2차원 벡터
#include <iostream>
#include <vector>
using namespace std;

int main() {
    vector<vector<int>> v = {{1,2},{3,4},{5,6}};
    for(vector<int> row: v) {
        for(int cell: row) {
            cout << cell << ' ';
        }
        cout << '\n';
    }
}

2 같이 보기

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