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

📄 cast.cpp

📁 这是一个C++的比较简单的例子,使用于初学者,建议入门级的人看看.
💻 CPP
字号:
// cast.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	// static_cast
	float f=5.5 ;
	int n=static_cast<int>(6.7) ;	
	cout<<n<<endl;	
	
	// reinterpret_cast
#if 0
//	int *p=static_cast<int*>(n);
	int *p=reinterpret_cast<int*>(n);
	cout<<p<<endl;
	
	int n1=reinterpret_cast<int>(p);
	cout<<p<<endl;
#endif
	return 0;
}

⌨️ 快捷键说明

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