首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

template中能带cout吗?该怎么处理

2012-03-15 
template中能带cout吗?今天用模板做一个函数但是在模板函数中的输出没有显示,请问大虾这是怎么会事?最好给

template中能带cout吗?
今天用模板做一个函数   但是在模板函数中的输出没有显示,请问大虾这是怎么会事?
最好给详细解答!

[解决办法]

#include "iostream "

using namespace std;


template <typename T>
void Print(T t)
{
cout < <t < <endl;
}


int main()
{
Print(100);
Print( "Hello STL ");
Print(1.23f);

return 0;
}

热点排行