直接取就可以了。例如:
string name="hello";
name[0];//这里name[0]就是第一个字符'h'
d
Press any key to continue
#include
#include
using namespace std;
main()
{
string aa="123asdf";
cout<
/* STRCPY.C: This program uses strcpy
* and strcat to build a phrase.
*/
#include
#include
void main( void )
{
char string[80];
strcpy( string, "Hello world from " );
strcat( string, "strcpy " );
strcat( string, "and " );
strcat( string, "strcat!" );
printf( "String = %s\n", string );
}
Output
String = Hello world from strcpy and strcat!