2022找工作是学历、能力和运气的超强结合体,遇到寒冬,大厂不招人,此时学会c++的话,
我所知道的周边的会c++的同学,可手握10多个offer,随心所欲,而找啥算法岗的,基本gg
提示:系列c++学习的基础和高阶知识,用于公司生产实践中,实实在在的公司部署产品要用的,因为c++速度快,
而java和Python速度慢,自然往硬件里面部署算法啥的,都得用c++或者c,因此本科学的c很重要,后来的Python或者java就没有那么重要了,

验证字符占用的空间,1字节,字符对应ASCII码值的对照表

红色就是咱们重点关注的0,a,A仨字符的ASCII码值
#include
using namespace std;
int main() {
char ch = 'a';
cout << ch << endl;
cout <<"char占用空间"<< sizeof(ch) << endl;
cout << sizeof(char) << endl;
ch = 'b';//重新赋值可以
cout << ch << endl;
//但是双引号表示字符串,而不是字符
//char ch2 = "a";
//单引号里面放多个字符,也不行滴
//char ch2 = 'abcc';
//我们看看ch的ASCII码值
cout << int(ch) << endl;
system("pause");
return 0;
}

你看b是98【ASCII码值】
a–z是连续的
所以a自然是97
A是65,
0是48
剩下的就连续++1就行


用了反斜杠’',说明c++准备开始输出特殊的字符啰,看你后面加啥
代码给你瞅瞅就知道,常用的就几个,不多
回车换行\n在c中没有
c++有endl
因此俩是等效的
#include
using namespace std;
int main() {
//换行\n
cout << "hello" << endl;//endl正常下就是endl
cout << "hello\n";
//反斜杠\\
//水平指标符号tab:\t
system("pause");
return 0;
}

\转义为一个反斜杠
\t是拢共8个空格,你前面x个字符串,后面就是8-x个空格,给你制作为标准的表格,动态调整对其,就是为了好看
#include
#include
#include
#include
#include
#include
using namespace std;
int main() {
//换行\n
cout << "hello" << endl;//endl正常下就是endl
cout << "hello\n";
//反斜杠
cout<<"\\"<<endl;//输入反斜杠\
//水平指标符号tab:\t
cout << "aaa\tbbb" << endl;//根据前面的字符串,拢共+\t一共8个空格,动态调整的
//string str;
//getline(cin, str);
//cout << str << endl;
//81
/*int n, i = 1, j = 2;
n = i < j ? i++ : j++;
cout << i << endl;
cout << j << endl;*/
//cout << f(5, 5) << endl;
/*unsigned char *p1;
unsigned int *p2;
p1 = (unsigned char*)0x801000;
p2 = (unsigned int*)0x810000;
cout << p1 + 3 << endl;
cout << p2 + 3 << endl;*/
//char *str[] = { "one","two","three" }, **p = str;
/*int a = 10;
int b = 11;
swap(a, b);
cout << a << endl;
cout<< b << endl;*/
//int a[] = { 1,2,3 }, *p = a;
//*p++ = 5;
//(*p)++;
//cout << a[0] << a[1] << a[2] << endl;
/*
int a = 320;
char *ptr;
ptr = (char*)&a;
cout << *ptr << endl;*/
/*int a[][] = { {0,0} };
std::vector b[] = { {0,0} };
std::map c = { {0,0} };
std::string d[] = { {0,0} };*/
system("pause");
return 0;
}

\t的目的就是为了好看,仅此而已
如果\t变为空格了的话,那就不那么好看了
比如

提示:重要经验:
1)转义字符就是没法用ASCII码表示,用反斜杠提示你这遇到了新的字符
2)学好c++,即使经济寒冬,手握10个大厂offer绝对不是问题!
3)笔试求AC,可以不考虑空间复杂度,但是面试既要考虑时间复杂度最优,也要考虑空间复杂度最优。