Tips:
1. 本人当初学习C/C++的记录。
2. 资源很多都是来自网上,如有版权请及时告知!
3. 可能会有些错误。如有看到,希望能指出,以此共勉!
目录
C++关键字
| auto | double | inline | short | typeid |
| bool | dynamic_cast | int | signed | typename |
| break | else | long | sizeof | union |
| case | enum | mutable | static | unsigned |
| catch | explicit | namespace | static_cast | using |
| char | export | new | struct | virtual |
| class | extern | operator | switch | void |
| const | false | private | template | volatile |
| const_cast | float | protected | this | wchar_t |
| continue | for | public | throw | while |
| default | friend | register | true | |
| delete | goto | reinterpret_cast | try |
C++11 关键字共73个。
新增关键字:alignas、alignof、char16_t、char32_t、constexpr、decltype、noexcept、nullptr、static_assert、thread_local
数据类型
基本类型:bool, char, int, float, double, void ,wchar_t,char16_t,char32_t
复合类型:结构体,公用体,枚举,数组,类
修饰:signed, unsigned, short, long
typedef可以位已经有的类型取一个新的名字
typedef int my_int;
变量类型
大小写敏感,必须以字母或下划线开头。
Lelf_values & Right_values
Lelf_values: 指向内存位置的表达式,左值可以出现在赋值号的左边或右边
Right_values: 指存储在内存中某些地址的数值。右值不能对其进行赋值操作,可以出现在赋值号的右边,但是不能出现在左边
常量
定义方法:#define 和const
#define identifier value // 定义在文件头,不需要用“;”结束
const type variable = value;
第一个C++程序
#include<iostream>
using namespace std; //启用标准命名空间
int main() //main()函数,程序入口
{
cout << "hello, world" << endl;
return 0; //结束
}
*每条语句结束记得加“;”哦。
本文详细介绍了C++编程语言的基础知识,包括73个C++关键字、数据类型、变量类型、常量定义方法以及如何编写第一个C++程序。适合初学者入门学习。

被折叠的 条评论
为什么被折叠?



