A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Tutorial%2FDevelopment%2Fcout_float</id>
		<title>C++ Tutorial/Development/cout float - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B_Tutorial%2FDevelopment%2Fcout_float"/>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Development/cout_float&amp;action=history"/>
		<updated>2026-04-10T18:51:10Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Development/cout_float&amp;diff=2133&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Development/cout_float&amp;diff=2133&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:17Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Development/cout_float&amp;diff=2134&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C%2B%2B_Tutorial/Development/cout_float&amp;diff=2134&amp;oldid=prev"/>
				<updated>2010-05-25T10:28:57Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Controlling precision of floating-point values==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   double root2 = sqrt( 2.0 );&lt;br /&gt;
   int places;&lt;br /&gt;
   cout &amp;lt;&amp;lt; setiosflags( ios::fixed)&lt;br /&gt;
        &amp;lt;&amp;lt; &amp;quot;Square root of 2 with precisions 0-9.\n&amp;quot;&lt;br /&gt;
        &amp;lt;&amp;lt; &amp;quot;Precision set by the &amp;quot;&lt;br /&gt;
        &amp;lt;&amp;lt; &amp;quot;precision member function:&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
   for ( places = 0; places &amp;lt;= 9; places++ ) {&lt;br /&gt;
      cout.precision( places );&lt;br /&gt;
      cout &amp;lt;&amp;lt; root2 &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   cout &amp;lt;&amp;lt; &amp;quot;\nPrecision set by the &amp;quot;&lt;br /&gt;
        &amp;lt;&amp;lt; &amp;quot;setprecision manipulator:\n&amp;quot;;&lt;br /&gt;
   for ( places = 0; places &amp;lt;= 9; places++ )&lt;br /&gt;
      cout &amp;lt;&amp;lt; setprecision( places ) &amp;lt;&amp;lt; root2 &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Displaying floating-point values in system default, scientific and fixed formats==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
using std::fixed;&lt;br /&gt;
using std::scientific;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   double x = 0.001234567;&lt;br /&gt;
   double y = 1.946e9;&lt;br /&gt;
   cout &amp;lt;&amp;lt; &amp;quot;Displayed in default format:&amp;quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; x &amp;lt;&amp;lt; &amp;quot;\t&amp;quot; &amp;lt;&amp;lt; y &amp;lt;&amp;lt; endl;&lt;br /&gt;
   cout &amp;lt;&amp;lt; &amp;quot;\nDisplayed in scientific format:&amp;quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; scientific &amp;lt;&amp;lt; x &amp;lt;&amp;lt; &amp;quot;\t&amp;quot; &amp;lt;&amp;lt; y &amp;lt;&amp;lt; endl;&lt;br /&gt;
   cout &amp;lt;&amp;lt; &amp;quot;\nDisplayed in fixed format:&amp;quot; &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; fixed &amp;lt;&amp;lt; x &amp;lt;&amp;lt; &amp;quot;\t&amp;quot; &amp;lt;&amp;lt; y &amp;lt;&amp;lt; endl;&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Displayed in default format:&lt;br /&gt;
0.00123457      1.946e+009&lt;br /&gt;
Displayed in scientific format:&lt;br /&gt;
1.234567e-003   1.946000e+009&lt;br /&gt;
Displayed in fixed format:&lt;br /&gt;
0.001235        1946000000.000000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Displaying numbers in scientific notation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
#include &amp;lt;limits&amp;gt;&lt;br /&gt;
using std::cout;&lt;br /&gt;
using std::endl;&lt;br /&gt;
using std::setprecision;&lt;br /&gt;
using std::numeric_limits;&lt;br /&gt;
int main() {&lt;br /&gt;
  const double pi = 3.14;&lt;br /&gt;
  cout &amp;lt;&amp;lt; endl;&lt;br /&gt;
  for(double radius = .2 ; radius &amp;lt;= 3.0 ; radius += .2)&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;radius = &amp;quot;&lt;br /&gt;
    &amp;lt;&amp;lt; setprecision(numeric_limits&amp;lt;double&amp;gt;::digits10 + 1)&lt;br /&gt;
    &amp;lt;&amp;lt; std::scientific &amp;lt;&amp;lt; radius&amp;lt;&amp;lt; &amp;quot;  area = &amp;quot;&lt;br /&gt;
         &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; setprecision(6)&amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; pi * radius * radi&lt;br /&gt;
us &amp;lt;&amp;lt; endl;&lt;br /&gt;
  return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;radius = 2.0000000000000001e-001  area =   0.125600&lt;br /&gt;
radius = 4.0000000000000002e-001  area =   0.502400&lt;br /&gt;
radius = 6.0000000000000009e-001  area =   1.130400&lt;br /&gt;
radius = 8.0000000000000004e-001  area =   2.009600&lt;br /&gt;
radius = 1.0000000000000000e+000  area =   3.140000&lt;br /&gt;
radius = 1.2000000000000000e+000  area =   4.521600&lt;br /&gt;
radius = 1.3999999999999999e+000  area =   6.154400&lt;br /&gt;
radius = 1.5999999999999999e+000  area =   8.038400&lt;br /&gt;
radius = 1.7999999999999998e+000  area =  10.173600&lt;br /&gt;
radius = 1.9999999999999998e+000  area =  12.560000&lt;br /&gt;
radius = 2.1999999999999997e+000  area =  15.197600&lt;br /&gt;
radius = 2.3999999999999999e+000  area =  18.086400&lt;br /&gt;
radius = 2.6000000000000001e+000  area =  21.226400&lt;br /&gt;
radius = 2.8000000000000003e+000  area =  24.617600&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ios::right|ios::scientific|ios::showpoint==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream.h&amp;gt;&lt;br /&gt;
main(void)&lt;br /&gt;
{&lt;br /&gt;
  float a=100100.0, b=0.08;&lt;br /&gt;
  cout.setf(ios::right|ios::scientific|ios::showpoint);&lt;br /&gt;
  cout.width(20);   &lt;br /&gt;
  cout &amp;lt;&amp;lt;(-a*b);&lt;br /&gt;
  &lt;br /&gt;
  return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;-8.008000e+003&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Normal (default) mode; only show 5 digits, including both sides of decimal point==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main( ) {&lt;br /&gt;
   ios_base::fmtflags flags = cout.flags( );&lt;br /&gt;
   double pi = 3.14285714;&lt;br /&gt;
   cout &amp;lt;&amp;lt; &amp;quot;pi = &amp;quot; &amp;lt;&amp;lt; setprecision(5) &amp;lt;&amp;lt; pi &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
   cout.flags(flags);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;pi = 3.1429&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>