sstream 与 fstream的使用



#include "stdafx.h"



#include 

#include 

#include 



#include 

#include 

#include 



#include  

#include 

using namespace std;



double reverse_double(double arg)

{

	ostringstream oss;

	oss << arg;

	string str = oss.str();

	for (int i = 0; i < str.size()/2; ++i)

	{

		char temp;

		temp = str[i];

		str[i] = str[str.size()-i-1];

		str[str.size()-i-1] = temp;

	}

	istringstream iss(str);

	iss >> arg;

	return arg;

}







int _tmain(int argc, _TCHAR* argv[])

{

	/*istringstream istr;

	istr.str("1 56.7");

	//上述两个过程可以简单写成 istringstream istr("1 56.7");

	cout << istr.str()<>a;

	cout<>b;

	cout<>a; 

	cout<>t; 

	cout<>s>>i; 

	CString str(s.c_str());

	

	wcout<>s;

	istring>>i; 

	istring>>i; 

	cout<>s1>>j;//要注意此处的顺序; 

	cout<>s>>b>>m;//将读取文件里第1个单词;getline(infile,s);将读取文件里的第1行 

		cout< wVec;

	wstring wStr;

	if(in)

	{

		while(!in.eof())

		{

			in>>wStr;

			wVec.push_back(wStr);

			wcout<::reverse_iterator  vw_rIter;

	for(vw_rIter = wVec.rbegin(); vw_rIter < wVec.rend(); vw_rIter++)

	{

		wcout<<*vw_rIter<<"__";

	}



	system("pause");



}

你可能感兴趣的:(Experience)