-
C++연습] vector for문 입력과 정렬코딩Coding/C++_연습 2022. 1. 25. 16:48728x90
http://icubeonline.xyz/c-vector-%EC%9E%85%EB%A0%A5%EA%B3%BC-%EC%A0%95%EB%A0%AC/
#include <iostream> #include <vector> using namespace std; void display(vector<int> &v) { for (int i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; } int main() { vector<int> vec1; int element, size; cout << "Enter the size of your vector" << endl; cin >> size; for (int i = 0; i < size; i++) { cout << "Enter an element to add to this vector : "; cin >> element; vec1.push_back(element); } display(vec1); return 0; }
역시 인도가 짱 ㅋㅋㅋ
https://www.youtube.com/watch?v=wKDvMcJiEPM
반응형'코딩Coding > C++_연습' 카테고리의 다른 글
C++❤계산기 만들기Calculator (0) 2022.11.28 C++연습] STL-Vectors벡터 구현하기 (0) 2022.05.13 C++연습)Vector of vectors(C++ Programming Tutorial-Engineer4Free (0) 2021.12.04 C++연습] Tutorial 19 - Vectors as Parameters (0) 2021.12.04 C ++연습] 튜토리얼 18-벡터와 벡터 함수-programminghelporg (0) 2021.12.04 C++연습]Vector_push back & pop back (0) 2021.12.04 C++연습)How to make Unit converter in C++[kilo->mile+function+switch (0) 2021.12.03 C++연습] Unit Converter (0) 2021.12.03