新手向-----C++学习手札(一)

来源:互联网 发布:java 身份证号取性别 编辑:程序博客网 时间:2024/05/21 09:01

作为一名想做游戏的程序猿,怎么能不了解C++。下定决心要学好C++之后,在此记录一些学习的笔记和心得。

本系列手札都是一些零散的个人笔记,仅供参考。

IDE用的是VS2015.


1.

C++数据流输入/输出头文件 iostream没有扩展名,可作为判断C/C++的一个特征

C++ #include <iostream>

C     #include <stdio.h>


2.

<< 流插入操作符 表示将右边的对象插入到左边的对象

std::cout
cout称之为标准输出对象(日常的为显示器)

std为标准命名空间,::为域分割符


3.

VC2015中,想让控制台暂停 不立马消失。有两种方式

1).添加头文件stdlib.h  即#include <stdlib.h>.随后在main()函数中调用system("pause");.

2).在VC环境下按 ctrl+F5,即执行不调试,控制台便不会自动关闭。

示例代码:

#include <iostream>#include <stdlib.h>using namespace std;int main() {//Display Aloha world to the consolecout << "Aloha world!" << endl;system("pause");return 0;}


0 0
原创粉丝点击