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

为什么小弟我这段函数什么都没有输出来>

2012-09-10 
为什么我这段函数什么都没有输出来?#include stdafx.h#include iostream #include sstream #inclu

为什么我这段函数什么都没有输出来>?
#include "stdafx.h"
#include <iostream >
#include < sstream >
#include < string >
#include < vector >
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int a = 12333;
ostringstream format_message;
  format_message<<"a = "<<a<<endl;
return 0;
}

[解决办法]
楼主的这个东西不是输出到屏幕上,是输出到字符串中了
输出到屏幕是用控制台标准输出cout
[解决办法]
#include <iostream >
#include < sstream >
#include < string >
#include < vector >
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int a = 12333;
ostringstream format_message;
format_message<<"a = "<<a<<endl;

string temp(format_message.str());

cout << temp << endl;
return 0;
}

热点排行