12.20.cpp

来自「这是C++的一部分练习程序!对初学者有一定的帮助作用。」· C++ 代码 · 共 24 行

CPP
24
字号
#include <iostream.h>
#include <fstream.h>
#include <strstrea.h>
void main()
{
	char buf[80];
	ostrstream out1(buf,sizeof(buf));
	int a=10;
	for(int i=0;i<5;i++)
		out1<<"a="<<(a+=5)<<';';
	out1<<'\0';
	cout<<"buf: "<<buf<<endl;
	double b=12.345678;
	out1.setf(ios::fixed|ios::showpoint);
	out1.seekp(0);
	out1<<"The value of b is "<<b<<'\0';
	cout<<"buf: "<<buf<<endl;
	char *pstr=out1.str();
	cout<<pstr<<endl;
}



⌨️ 快捷键说明

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