当前位置:网站首页>Two expressions of string
Two expressions of string
2022-07-01 07:47:00 【On the bald Road】
1.c++ Inherited c Writing , character string c The style of writing :
char b[4] = { 'w','c','c','\0'};
char a[6] = { "loveu" };
/*char a[6] = { "loveuy" }; By default, it will be followed by /0 To indicate the end , So it's better than 6 One less bit to store /0, This writing will report an error */
2.C++ Their own string type
string s = "run";
example :
#include<iostream>
using namespace std;
int main() {
// character string c The style of writing
char b[4] = { 'w','c','c','\0'};
char a[6] = { "loveu" };
/*char a[6] = { "loveuy" }; By default, it will be followed by /0 To indicate the end , So it's better than 6 One less bit to store /0, This writing will report an error */
cout << a <<endl;
cout << b << endl;
// character string c++ Style writing
string s = "run";
cout << s << endl;
// String common functions
// Connect
string s1 = "run";
string s2 = "go";
string str = s1 + s2;
cout << str << endl;
// Copy
string s3;
s3 = s2;
cout << s3;
// Return string s1 The length of .
return 0;
}Add : Connection copy function of string (strcpy,strcat) Can't use , Personal access to data is considered abandoned by the version , The available methods are given in the code .
边栏推荐
- Redisson utilise la solution complète - redisson Documents officiels + commentaires (Partie 1)
- I bet on performance and won the CTO of the company. I want to build Devops platform!
- Caesar
- LSTM of RNN
- 2022电工(中级)复训题库及答案
- Jax's deep learning and scientific computing
- JAX的深度学习和科学计算
- Redisson uses the complete solution - redisson official documents + Notes (Part 1)
- redisson使用全解——redisson官方文档+注释(中篇)
- [untitled]
猜你喜欢

【批处理DOS-CMD-汇总】扩展变量-延迟变量cmd /v:on、cmd /v:off、setlocal enabledelayedexpansion、DisableDelayedExpansion

Download xshell and xftp

What information does the supplier need to know about Audi EDI project?

组件的自定义事件①

Cyclic neural network

Gru of RNN

PWN攻防世界int_overflow

base64

【推荐系统】美团外卖推荐场景的深度位置交互网络DPIN的突破与畅想

ctfshow-web352,353(SSRF)
随机推荐
2022 tea master (intermediate) recurrent training question bank and answers
Vscode automatically formats code according to eslint specification
2022危险化学品经营单位主要负责人试题及模拟考试
Mysql与Redis一致性解决方案
【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
2022年茶艺师(中级)复训题库及答案
ONES 创始人王颖奇对话《财富》(中文版):中国有没有优秀的软件?
Gru of RNN
C # read and write customized config file
Apple账号密码自动填充
【R语言】两个/N个数据合并merge函数
The computer has a network, but all browser pages can't be opened. What's the matter?
Why some people earn nearly 10billion a year, while others earn 3000 a month: the details you ignore actually make the most money
038 network security JS
1286_ Implementation analysis of task priority setting in FreeRTOS
【批处理DOS-CMD命令-汇总和小结】-Cmd窗口中常用操作符(<、<<、&<、>、>>、&>、&、&&、||、|、()、;、@)
组件的自定义事件②
go通用动态重试机制解决方案的实现与封装
Browser local storage
[kv260] generate chip temperature curve with xadc