写一个输出变量类型的案例MFC
时间: 2024-05-12 19:16:29 浏览: 79
以下是一个MFC程序,可以输出变量的类型:
```
#include "stdafx.h"
#include <iostream>
#include <typeinfo>
using namespace std;
int main()
{
int a = 5;
double b = 3.14;
char c = 'c';
const char* d = "hello world";
cout << "a is of type " << typeid(a).name() << endl;
cout << "b is of type " << typeid(b).name() << endl;
cout << "c is of type " << typeid(c).name() << endl;
cout << "d is of type " << typeid(d).name() << endl;
return 0;
}
```
运行程序后,将会输出以下结果:
```
a is of type int
b is of type double
c is of type char
d is of type char const *
```
阅读全文