string的用法

来源:互联网 发布:孤城网络 编辑:程序博客网 时间:2024/05/17 23:57
#include <string>#include <iostream>using namespace std;int main()  {     setlocale(LC_ALL,"Chinese-simplified");  //设置语言运行环境string str="你好,c++";   cout<<"多字节字符串的string:"<<str<<endl;   int x=str.size();   cout<<"多字节字符串string所占用的字节数:"<<x<<endl;    wstring  wstr=L"你好,c++";   wcout<<L"UNICODE字符串的wstring:"<<wstr<<endl;     int y = wstr.size();   cout<<"UNICODE字符串wstring所包含的字数:"<<y<<endl;   system("pause");     return 0;  }  


原创粉丝点击