当前位置:网站首页>STL string
STL string
2022-07-18 18:27:00 【joker_ 0030】
1、 System default
#include<iostream>
#include<cstring>//string class .
using namespace std;// Standard namespace .
int main()
{ // Create objects
string str;//NULL *m_str=NULL , new char('\n')
const char* str1 = str.c_str();// new char('\n')
//cout << str;
system("pause");
return 0;
}
2、 Customize
#include<iostream>
#include<cstring>//string class .
using namespace std;
class stu
{
private:
char* m_str;
public:
stu()
{
m_str = new char('\n');
}
public:
const char* c_str() const
{
return m_str;
}
};
int main()
{
stu db;
const char* db1 =db.c_str();
system("pause");
return 0;
}
边栏推荐
猜你喜欢

TCP拥塞控制详解 | 6. 主动队列管理

MySQL超详细安装教程 手把手教你安装MySQL到使用MySQL 最简单的MySQL安装方式,这种方式装,卸载也简单

进程【详细总结】

Huawei image xmage: seek all the images in the world, and finally see the Bodhi Heart

【实战】快来和我一起开发一个在线 Web 代码编辑器

墨者学院刷题笔记——SQL手工注入漏洞测试(MongoDB数据库)

26 top open source projects, 87 open tasks, Alibaba programming summer 2022 student registration channel opened

找不到 cl.exe 解决办法

协作进程【简单总结】

2022 P gas cylinder filling examination questions and simulation examination
随机推荐
Boost create folder
Image xmage de Huawei: Cherchez toutes les images du monde et voyez enfin Bodhisattva
Kaggle文件下载(权重、推理文件...)
Pay equal attention to quality and efficiency, test left shift power block storage technology research and development
网络爬虫爬取三国演义所有章节的标题和内容(BeautifulSoup解析)
T-无限的路
Package C language files into exe executable programs
Enter a URL and explain the whole process
The simple solution the boss wants vs. the needs the programmer understands | cartoon
HALCON联合C#检测表面缺陷——ROI交互(二)(和图片同步缩放裁剪等功能)
深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
2022.7.14-----leetcode.745
2022 G3 boiler water treatment examination question bank and simulation examination
C#网络应用编程,异步编程基础练习
【第33天】或运算 | 的使用 | 连续低位0变1
九联科技开发板正式合入OpenHarmony主干
Concept correlation and pattern matching of strings
2022 latest Tianjin Construction Safety Officer simulation question bank and answers
云原生:Docker 实践经验(四)docker上部署 redis 三主三从集群
STL string