File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -759,26 +759,26 @@ In C++ you use strings like so:
759759// cpp
760760
761761// creating a string
762- string hello = " hello" ; // c++ style
762+ std:: string hello = " hello" ; // c++ style
763763char hello[] = " hello" ; // plain c style
764764char * hello = " hello" ; // plain c style
765765
766766// combining strings
767- string combined = hello + " world" ;
767+ std:: string combined = hello + " world" ;
768768
769769// comparing strings
770770bool test = (" apple" == " orange" );
771771
772772// number to string
773773int age = 22 ;
774- string message = to_string(age) + " years old" ;
774+ std:: string message = std:: to_string(age) + " years old" ;
775775
776776// get length of string
777- string test = " test" ;
777+ std:: string test = " test" ;
778778int length = test.length();
779779
780780// indexing a string
781- string test = " test" ;
781+ std:: string test = " test" ;
782782char index = test[0 ];
783783```
784784
You can’t perform that action at this time.
0 commit comments