Diambil dari rujukan [1]
Cara susah:
string str;
char array[] = "Hello World";
for(int i = 0; array[i] != 0; i++)
str += array[i];
Cara senang
string str;
char array[] = "Hello World";
str = array;
Rujukan:
[1] http://www.programmersheaven.com/mb/CandCPP/309708/309708/converting-char-array-to-string-type/
No comments:
Post a Comment