티스토리 뷰
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
char words[] = "Hello";
for (auto t : words) {
cout << t << endl;
}
return EXIT_SUCCESS;
}
/* Output
H
e
l
l
o
*/
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
string words = "Hello";
for (auto t : words)
{
cout << t << endl;
}
return EXIT_SUCCESS;
}
/* Output
H
e
l
l
o
*/
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char **argv) {
vector<string> animals = { "cat", "dog", "fox" };
for (string article : animals) {
cout << article.c_str() << endl;
}
return EXIT_SUCCESS;
}
/* Output
cat
dog
fox
*/
'Ongoing > String' 카테고리의 다른 글
[C# C++ Python] verbatim string, raw string literal (0) | 2019.04.19 |
---|---|
[C#] Composite Format String & Interpolated String (0) | 2018.07.09 |
for [Java] String (0) | 2018.06.20 |
for foreach [C#] string (0) | 2018.06.20 |
for [Python] string (0) | 2018.06.20 |