-
C++연습]Vector_push back & pop back코딩Coding/C++_연습 2021. 12. 4. 12:26728x90
#include <vector> #include <iostream> using namespace std; int main() { vector<string> list; cout << "Please enter the names, press Q to quit: " << endl; string name = "x"; while (name != "Q" && name != "q") { cin >> name; list.push_back(name); } list.pop_back(); cout << "You have entered " << list.size() << " names: " << endl; for (int i = 0; i < list.size(); i++) { cout << list[i] << endl; } return 0; } // .push_back() // .pop_back()
출처 :
https://www.youtube.com/watch?v=opAnlfre-Kw
반응형'코딩Coding > C++_연습' 카테고리의 다른 글
C++연습] vector for문 입력과 정렬 (0) 2022.01.25 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++연습)How to make Unit converter in C++[kilo->mile+function+switch (0) 2021.12.03 C++연습] Unit Converter (0) 2021.12.03 C++연습] Programming Challenge 77개 도전 gogo~ (0) 2021.12.03 C++연습] C++ Finding Smallest & Largest Integers(C++ While Loop) (0) 2021.12.03