c++解释--百度百科
-
c++
- 中文名
- C++语言
- 外文名
- The C++ Programming Language
- 类 别
- 计算机程序设计语言
- 创始人
- Bjarne Stroustrup
- 创始公司
- 贝尔实验室
- 基本内容
- 类、封装、重载、继承、模版
目录
- 1 从C到C++
- ▪ 名称由来
- ▪ 发展历史
- ▪ 与C的关系
- ▪ 与C不兼容之处
- 2 语言特点
- ▪ 优点
- ▪ 缺点
- 3 数据类型
- ▪ 数据定义
- ▪ 基本类型
- ▪ 类型转换
- 4 编程技巧
- ▪ new和delete
- ▪ inline
- ▪ 函数重载
- ▪ 参数传递
- ▪ 缺省参数
- ▪ 使用STL
- ▪ 使用模板
- 5 类和对象
- ▪ 声明类类型
- ▪ 定义对象
- 6 类和结构体
- 7 关键字
- 8 编程开发
- ▪ 代码实现
- ▪ 命令行开发方式
- ▪ 集成开发环境(IDE)
- 9 多泛型设计
- 10 经典著作
- ▪ 入门书籍
- ▪ 进阶书籍
- ▪ 高阶书籍
- 11 常见错误
- 12 争议
- 13 C++ 标准
- ▪ C++ 98 标准
- ▪ C++ 03 标准
- ▪ C++ 11 标准
- ▪ C++ 14 标准
从C到C++
编辑
名称由来
发展历史
与C的关系
与C不兼容之处
1
2
3
4
5
|
//从void*
类型隐式转换为 int *
类型
int *i= malloc ( sizeof ( int )*5);
|
1
|
int *i=( int *) malloc ( sizeof ( int )*5);
|
语言特点
编辑
优点
缺点
数据类型
编辑
数据定义
基本类型
类型转换
- 在混合类型的算术表达式中
- intival=3; doubledval=3.1415 ival+dval;//ival被提升为double类型:3.0
- 用另外一种类型的表达式赋值
- int*pi=NULL;//NULL(0)被转换成了int*类型的空指针值
- 用一个表达式传递给一个函数调用
- externdoublesqrt(double); sqrt(2);//2被提升为double类型:2.0
- 从一个函数返回一个表达式
- doubledifference(intival1,intival2) { returnival1-ival2;//返回值被提升为double类型. }
- static_cast:用法:static_cast < type-id > ( expression )说明:该运算符把expression转换为type-id类型,但没有运行时类型检查来保证转换的安全性。
- dynamic_cast :用法:dynamic_cast < type-id > (expression)说明:该运算符把expression转换成type-id类型的对象。Type-id必须是类的指针、类的引用或者void*;
- const_cast:用法:const_cast<type_id> (expression)说明:该运算符用来修改类型的const或volatile属性。除了const 或volatile修饰之外, type_id和expression的类型是一样的。
- reinterpret_cast :用法:reinterpret_cast<type-id> (expression)说明:type-id 必须是一个指针、引用、算术类型、函数指针或者成员指针。它可以把一个指针转换成一个整数,也可以把一个整数转换成一个指针(先把一个指针转换成一个整数,在把该整数转换成原类型的指针,还可以得到原先的指针值)。
编程技巧
编辑
new和delete
inline
函数重载
参数传递
缺省参数
使用STL
使用模板
类和对象
编辑
声明类类型
1
2
3
4
5
6
7
|
struct Student //声明了一个名为Student的结构体类型
{
int num;
char name[20];
char sex;
};
Student stud1,stud2; //定义了两个结构体变量stud1和stud2,它只包括数据,没有包括操作
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class Student //以class开头
{
int num;
char name[20];
char sex; //以上3行是数据成员
void display() //这是成员函数
{
cout<<″num:″<<num<<endl;
cout<<″name:″<<name<<endl;
cout<<″sex:″<<sex<<endl;
}; //以上4行是函数中的操作语句
};
Student stud,stud1; //定义了两个对象stud和stud1
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
class Student //以class开头
{
private : //声明私有成员
intnum;
char name[20];
char sex;
public : //声明公共成员
void display()
{
cout<<″num:″<<num<<endl;
cout<<″name:″<<name<<endl;
cout<<″sex:″<<sex<<endl;
}
};
Student stud1,stud2; //定义了两个对象stud1和stud2
|
1
2
3
4
5
6
7
8
|
class 类名
{
private :
//私有的数据和成员函数;
public :
//公用的数据和成员函数;
};
|
定义对象
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
class Student{ //声明类类型
public : //先声明公用部分
void display(){
cout<<″num:″<<num<<endl;
cout<<″name:″<<name<<endl;
cout<<″sex:″<<sex<<endl;
}
private : //后声明私有部分
int num;
char name[20];
char sex;
}stud1,stud2; //定义了两个Student类的对象
|
1
2
3
4
5
6
7
|
class //无类名
{
private : //声明以下部分为私有的
//...
public : //声明以下部分为公用的
//...
}stud1,stud2; //定义了两个无类名的类对象
|
类和结构体
编辑
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
structStudent{ //用关键字struct来声明一个类类型
private : //声明以下部分为私有的
int num; //以下3行为数据成员
char name[20];
char sex;
public : //声明以下部分为公用的
void display(){ //成员函数
cout<<″num:″<<num<<endl;
cout<<″name:″<<name<<endl;
cout<<″sex:″<<sex<<endl;
}
};
Student stud1,stud2; //定义了两个Student类的对象
|
关键字
编辑
asm
|
do
|
if
|
return
|
typedef
|
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
|
编程开发
编辑
代码实现
Unix: | C, cc, cxx, c |
GNU C++: | C, cc, cxx, cpp, c++ |
Digital Mars: | cpp, cxx |
Borland: | C++ cpp |
Watcom: | cpp |
Microsoft Visual C++: | cpp, cxx, cc |
Metrowerks CodeWarrior: | cpp, cp, cc, cxx, c++ |
命令行开发方式
集成开发环境(IDE)
4.Dev-C++ (MinGW32 + GCC)
多泛型设计
编辑
经典著作
编辑
入门书籍
进阶书籍
高阶书籍
常见错误
编辑
英文
|
参考译文
|
---|---|
Ambiguous operators need parentheses
|
模棱两可的操作符需要括号
|
Ambiguous symbol ''xxx''
|
不明确的符号
|
Argument list syntax error
|
参数表语法错误
|
Array bounds missing
|
数组界限符丢失
|
Array size toolarge
|
数组尺寸太大
|
Bad character in paramenters
|
参数中有不适当的字符
|
Bad file name format in include directive
|
包含命令中文件名格式不正确
|
Bad ifdef directive synatax
|
编译预处理ifdef有语法错
|
Bad undef directive syntax
|
编译预处理undef有语法错
|
Bit field too large
|
位字段太长
|
Call of non-function
|
调用未定义的函数
|
Call to function with no prototype
|
调用函数时没有函数的说明
|
Cannot modify a const object
|
不允许修改常量对象
|
Case outside of switch
|
漏掉了case 语句
|
Case syntax error
|
Case 语法错误
|
Code has no effect
|
代码不可能被执行到
|
Compound statement missing{
|
分程序漏掉"{"
|
Conflicting type modifiers
|
互相冲突的类型说明符设置
|
Constant expression required
|
需要常量表达式
|
Constant out of range in comparison
|
在比较中常量超出范围
|
Conversion may lose significant digits
|
转换时会丢失数值的精度
|
Conversion of near pointer not allowed
|
不允许转换近指针
|
Could not find file ''xxx''
|
找不到XXX文件
|
Declaration missing ;
|
声明中缺少";"
|
Declaration syntax error
|
声明中出现语法错误
|
Default outside of switch
|
Default 出现在switch语句之外
|
Define directive needs an identifier
|
定义编译预处理需要标识符
|
Division by zero
|
用零作除数
|
Do statement must have while
|
Do-while语句中缺少while部分
|
Enum syntax error
|
枚举类型语法错误
|
Enumeration constant syntax error
|
枚举常数语法错误
|
Error directive :xxx
|
错误的编译预处理命令
|
Error writing output file
|
写输出文件错误
|
Expression syntax error
|
表达式语法错误
|
Extra parameter in call
|
调用时出现多余错误
|
File name too long
|
文件名太长
|
Function call missing
|
函数调用缺少右括号
|
Fuction definition out of place
|
函数定义位置错误
|
Fuction should return a value
|
函数必需返回一个值
|
Goto statement missing label
|
Goto语句没有标号
|
Hexadecimal or octal constant too large
|
16进制或8进制常数太大
|
Illegal character ''x''
|
非法字符x
|
Illegal initialization
|
非法的初始化
|
Illegal octal digit
|
非法的8进制数字
|
Illegal pointer subtraction
|
非法的指针相减
|
Illegal structure operation
|
非法的结构体操作
|
Illegal use of floating point
|
非法的浮点运算
|
Illegal use of pointer
|
指针使用非法
|
Improper use of a typedefsymbol
|
类型定义符号使用不恰当
|
In-line assembly not allowed
|
不允许使用行间汇编
|
Incompatible storage class
|
存储类别不相容
|
Incompatible type conversion
|
不相容的类型转换
|
Incorrect number format
|
错误的数据格式
|
Incorrect use of default
|
Default使用不当
|
Invalid indirection
|
无效的间接运算
|
Invalid pointer addition
|
指针相加无效
|
Irreducible expression tree
|
无法执行的表达式运算
|
Lvalue required
|
需要逻辑值0或非0值
|
Macro argument syntax error
|
宏参数语法错误
|
Macro expansion too long
|
宏的扩展以后太长
|
Mismatched number of parameters in definition
|
定义中参数个数不匹配
|
Misplaced break
|
此处不应出现break语句
|
Misplaced continue
|
此处不应出现continue语句
|
Misplaced decimal point
|
此处不应出现小数点
|
Misplaced elif directive
|
不应编译预处理elif
|
Misplaced else
|
此处不应出现else
|
Misplaced else directive
|
此处不应出现编译预处理else
|
Misplaced endif directive
|
此处不应出现编译预处理endif
|
Must be addressable
|
必须是可以编址的
|
Must take address of memory location
|
必须存储定位的地址
|
No declaration for function ''xxx''
|
没有函数xxx的说明
|
No stack
|
缺少堆栈
|
No type information/没有类型信息
|
缺少堆栈
|
Non-portable pointer assignment
|
不可移动的指针(地址常数)赋值
|
Non-portable pointer comparison
|
不可移动的指针(地址常数)比较
|
Non-portable pointer conversion
|
不可移动的指针(地址常数)转换
|
Not a valid expression format type
|
不合法的表达式格式
|
Not an allowed type
|
不允许使用的类型
|
Numeric constant too large
|
数值常太大
|
Out of memory
|
内存不够用
|
Parameter ''xxx'' is never used
|
能数xxx没有用到
|
Pointer required on left side of ->
|
符号->的左边必须是指针
|
Possible use of ''xxx'' before definition
|
在定义之前就使用了xxx(警告)
|
Possibly incorrect assignment
|
赋值可能不正确
|
Redeclaration of ''xxx''
|
重复定义了xxx
|
Redefinition of ''xxx'' is not identical
|
xxx的两次定义不一致
|
Register allocation failure
|
寄存器定址失败
|
Repeat count needs an lvalue
|
重复计数需要逻辑值
|
Size of structure or array not known
|
结构体或数给大小不确定
|
Statement missing ;
|
语句后缺少";"
|
Structure or union syntax error
|
结构体或联合体语法错误
|
Structure size too large
|
结构体尺寸太大
|
Sub scripting missing ]
|
下标缺少右方括号
|
Superfluous & with function or array
|
函数或数组中有多余的"&"
|
Suspicious pointer conversion
|
可疑的指针转换
|
Symbol limit exceeded
|
符号超限
|
Too few parameters in call
|
函数调用时的实参少于函数的参数不
|
Too many default cases
|
Default太多(switch语句中一个)
|
Too many error or warning messages
|
错误或警告信息太多[13]
|
英文
|
参考译文
|
---|---|
Too many type in declaration
|
说明中类型太多
|
Too much auto memory in function
|
函数用到的局部存储太多
|
Too much global data defined in file
|
文件中全局数据太多
|
Two consecutive dots
|
两个连续的句点
|
Type mismatch in parameter xxx
|
参数xxx类型不匹配
|
Type mismatch in redeclaration of ''xxx''
|
xxx重定义的类型不匹配
|
Unable to create output file ''xxx''
|
无法建立输出文件xxx
|
Unable to open include file ''xxx''
|
无法打开被包含的文件xxx
|
Unable to open input file ''xxx''
|
无法打开输入文件xxx
|
Undefined label ''xxx''
|
没有定义的标号xxx
|
Undefined structure ''xxx''
|
没有定义的结构xxx
|
Undefined symbol ''xxx''
|
没有定义的符号xxx
|
Unexpected end of file in comment started on line xxx
|
从xxx行开始的注解尚未结束文件不能结束
|
Unexpected end of file in conditional started on line xxx
|
从xxx 开始的条件语句 尚未结束文件不能结束
|
Unknown assemble instruction
|
未知的汇编结构
|
Unknown option
|
未知的操作
|
Unknown preprocessor directive: ''xxx''
|
不认识的预处理命令xxx
|
Unreachable code
|
无路可达的代码
|
Unterminated string or character constant
|
字符串缺少引号
|
User break
|
用户强行中断了程序
|
Void functions may not return a value
|
Void类型的函数不应有返回值
|
Wrong number of arguments
|
调用函数的参数数目错
|
''xxx'' not an argument
|
xxx不是参数
|
''xxx'' not part of structure
|
xxx不是结构体的一部分
|
xxx statement missing (
|
xxx语句缺少左括号
|
xxx statement missing )
|
xxx语句缺少右括号
|
xxx statement missing ;
|
xxx缺少分号
|
xxx'' declared but never used
|
说明了xxx但没有使用
|
xxx'' is assigned a value which is never used
|
给xxx赋了值但未用过
|
Zero length structure
|
结构体的长度为零[14]
|
争议
编辑
C++ 标准
编辑
C++ 98 标准
C++ 03 标准
C++ 11 标准
C++ 14 标准
转载于:https://www.cnblogs.com/hoobey/p/5440067.html
c++解释--百度百科相关推荐
- MySQL解释--百度百科
MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下公司.MySQL 最流行的关系型数据库管理系统,在 WEB 应用方面MySQL是最好的 RDBMS ...
- 计算机窗口是什么意思解释,界面(概念用语)_百度百科
[jiè miàn] 界面 (概念用语) 语音 编辑 锁定 讨论 上传视频 界面是指物质相与相的分界面.因为我们周围的物质是以气.液.固三种状态存在,所以也就有了气.液.固三相.在各相之间存在着气-液 ...
- 【网络爬虫】BeautfulSoup爬百度百科(真の能看懂~!)
文章目录 1 百度百科 2 观看规律 3 制作爬虫 4 结果 1 百度百科 百度百科中有很多名词的解释信息, 我们今天从 "网页爬虫" 的词条开始爬, 然后在页面中任意寻找下一个词 ...
- python语言百度百科-Python 语言下数据驱动DDT的应用
数据驱动测试的含义: 在百度百科上的解释是: 数据驱动测试,即黑盒测试(Black-box Testing),又称为功能测试,是把测试对象看作一个黑盒子.利用黑盒测试法进行动态测试时,需要测试软件产品 ...
- 用python 爬取百度百科内容-爬虫实战(一) 用Python爬取百度百科
最近博主遇到这样一个需求:当用户输入一个词语时,返回这个词语的解释 我的第一个想法是做一个数据库,把常用的词语和词语的解释放到数据库里面,当用户查询时直接读取数据库结果 但是自己又没有心思做这样一个数 ...
- python爬取百度百科表格_第一个python爬虫(python3爬取百度百科1000个页面)
以下内容参考自:http://www.imooc.com/learn/563 一.爬虫简介 爬虫:一段自动抓取互联网信息的程序 爬虫可以从一个url出发,访问其所关联的所有的url.并从每个url指向 ...
- linux——百度百科
https://baike.baidu.com/item/linux/27050?fr=aladdin linux 编辑 本词条由"科普中国"百科科学词条编写与应用工作项目审核. ...
- C语言typedef小结1(转载自百度百科)
声明:此信息是转载自百度百科中 http://baike.baidu.com/view/1283800.htm 的信息 typedef小结 1.使用typedef为现有类型创建同义字,定义易于记忆的 ...
- 弗拉明戈舞_百度百科
弗拉明戈舞_百度百科 弗拉明戈舞 编辑 弗拉明戈舞简介"弗拉明戈"不仅是歌(cante).舞(baile)和吉他音乐(toque)的三合一艺术,也代表着一种慷慨.狂 ...
- Hadoop 百度百科
Hadoop 百度百科 来源地址:https://baike.baidu.com/item/Hadoop/3526507?fr=aladdin 本词条由"科普中国"百科科学词条编写 ...
最新文章
- 利用partition分组查询 查询每个分组第一条数据
- controller-runtime 控制器实现
- java8 streams_Java 8 Streams API:对流进行分组和分区
- 具有NetBeans,嵌入式GlassFish,JPA和MySQL数据源的Arquillian
- (计算机组成原理)第二章数据的表示和运算-第二节8:数据的存储和排列
- Diccuz!NT的dll版本号控制技巧
- 【Flink】Flink AM container is launched, waiting for AM container to Register with RM
- %12d在c语言中的意思,《C语言程序设计》习题.doc
- STM32跑html协议,stm32实现1588协议
- 一、环境的安装Dev-C++
- axure 教务系统_AxureRP免费(教育)授权密钥申请攻略
- 菜鸟晋级篇!一篇文章读懂看门狗定时器!
- Python 免费教程视频-微软教学
- 数据基础---《利用Python进行数据分析·第2版》第11章 时间序列
- 最帅爬虫_豆瓣读书(加密数据获取)
- [iOS]仿微博视频边下边播之滑动TableView自动播放
- NVIDIA GPU的浮点计算能力
- 谷歌浏览器Chrome中文乱码(已解决)
- 杭电 2016 计算机组成原理,杭电计算机组成原理寄存器堆设计实验4.doc
- windows操作系统支持文件名大小写区分的设置方法