⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 宏assert的用法.txt

📁 里面的代码是自己写的,参考书是thingking in c++,代码有详细的说明,对学习c++语法非常有帮助!
💻 TXT
字号:
/*本程序对应于P197。
* 本程序是为了说明 assert()宏的用法
*注意点1:when you use assert(),you give it an argument that is an expression
*you are "asserting to be true."the preprocessor generates code that will 
*test the assertion.If the assertion isn't true ,the program will stop after
*issuing an error message telling you what the assertion was and that it
*failed.
*注意点2:When you finished debugging,you can remove the code genereted
* by the macro by placing the line : #define NDEBUG in the program before
*the inclusion of <cassert>.
*/
#include<iostream>
//#define NDEBUG  //参考注意点2的说明
#include<cassert>
using namespace std;

int main()
{
	int i = 100;
	assert(i != 100);   //fails
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -