cpp06.cpp

来自「C++参考书」· C++ 代码 · 共 29 行

CPP
29
字号

// Coded by plusir -- Jan.14.2003.
// Standard C++ Bible -- (P749-27-6)

#include <iostream>
#include <typeinfo>
using namespace std ;

class Control { } ;

int main()
{
	Control ct ;
	cout << "ct is a " << typeid( ct ).name() << endl ;

	double counter = 1.23 ;

	if ( typeid( counter ) != typeid( Control ) )
		cout << "counter is not a " << typeid( Control ).name() << endl ;

	if ( typeid( counter ) == typeid( 1.23 ) )
		cout << "counter is double" << endl ;

	if ( typeid( counter ) != typeid( int ) )
		cout << "counter is not an integer value" << endl ;

	return 0 ;
}

⌨️ 快捷键说明

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