โ int → string
#<string>
to_string
int num = 12345;
string str = to_string(num);
โ string → int
#<string>
stoi
string str = "abcde";
int num = stoi(str);
โ char* → int
#<stdilb.h> ๋๋ #<cstdlib>
atoi()
char* cStr = "abcde";
int num = atoi(cStr);
โ string → char* → int
#<cstdlib>, #<string>
c_str() → atoi()
string s = "abcde";
int num = atoi(s.c_str());
'๐ > C++' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[C++] priority_queue ์ฐ์ ์์ ํ (0) | 2020.03.25 |
---|---|
[C++] ๋ฐฐ์ด๋ณต์ฌ memcpy, copy (0) | 2020.03.23 |
[C++] map iterator(๋ฐ๋ณต์) ํ์ฉ (0) | 2020.03.23 |
[C++] string ๋ฉ์๋ ์ ๋ฆฌ (0) | 2020.03.17 |
[C++] vector ๋ฐฐ์ด ์ค๋ณต ์ ๊ฑฐ ํ๋ ๋ฒ (0) | 2020.03.10 |
๋๊ธ