C++/String/string char array — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...)  | 
				Admin (обсуждение | вклад)  м (1 версия: Импорт контента...)  | 
				
(нет различий) 
 | |
Текущая версия на 10:25, 25 мая 2010
Convert string to C-Style string
 
 
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
int main()
{
   string string1( "STRINGS" );
   cout << "string string1 is " << string1
      << "\nstring1 converted to a C-Style string is "
      << string1.c_str() << "\n";
   return 0;
}
/* 
string string1 is STRINGS
string1 converted to a C-Style string is STRINGS
 */