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%2FData_Type%2FDouble</id>
		<title>C/Data Type/Double - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2FData_Type%2FDouble"/>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C/Data_Type/Double&amp;action=history"/>
		<updated>2026-04-09T13:47:55Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://cppe.ru/index.php?title=C/Data_Type/Double&amp;diff=342&amp;oldid=prev</id>
		<title> в 14:20, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C/Data_Type/Double&amp;diff=342&amp;oldid=prev"/>
				<updated>2010-05-25T14:20:56Z</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:20, 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/Data_Type/Double&amp;diff=343&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C/Data_Type/Double&amp;diff=343&amp;oldid=prev"/>
				<updated>2010-05-25T10:22:40Z</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;==A function to output double values in a given width==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ctype.h&amp;gt;&lt;br /&gt;
#define MAX_COUNT 100&lt;br /&gt;
void show(double array[], size_t array_size, unsigned int field_width);&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  double array[MAX_COUNT] = {0.0};&lt;br /&gt;
  int count = 6;&lt;br /&gt;
  char answer = &amp;quot;n&amp;quot;;&lt;br /&gt;
  array[0] = 123456.123456;&lt;br /&gt;
  array[1] = 12345.12345;&lt;br /&gt;
  array[2] = 1234.1234;&lt;br /&gt;
  array[3] = 123.123;&lt;br /&gt;
  array[4] = 12.12;&lt;br /&gt;
  array[5] = 1.1;&lt;br /&gt;
  show(array, count, 12);&lt;br /&gt;
  printf(&amp;quot;\n\n\n&amp;quot;);&lt;br /&gt;
  show(array, count, 2);&lt;br /&gt;
  printf(&amp;quot;\n\n\n&amp;quot;);&lt;br /&gt;
  show(array, count, 6);&lt;br /&gt;
}&lt;br /&gt;
void show(double array[], size_t array_size, unsigned int field_width)&lt;br /&gt;
{&lt;br /&gt;
  char format[10] = &amp;quot;%&amp;quot;;&lt;br /&gt;
  char width_str[4];&lt;br /&gt;
  int i = 0;&lt;br /&gt;
  int j = 1;&lt;br /&gt;
  do&lt;br /&gt;
  {&lt;br /&gt;
    width_str[i++] = &amp;quot;0&amp;quot;+field_width%10;&lt;br /&gt;
  }while((field_width /= 10) != 0);&lt;br /&gt;
  do&lt;br /&gt;
  {&lt;br /&gt;
    format[j++] = width_str[--i];&lt;br /&gt;
  }while(i&amp;gt;0);&lt;br /&gt;
  format[j] = &amp;quot;\0&amp;quot;;&lt;br /&gt;
  strcat(format, &amp;quot;lf&amp;quot;);&lt;br /&gt;
  for(j = 0 ; j&amp;lt;array_size ; j++)&lt;br /&gt;
  {&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(format, array[j]);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Calculating average hourly pay rate==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  double pay = 0.0;&lt;br /&gt;
  double hours = 0.0;&lt;br /&gt;
  int dollars = 0;&lt;br /&gt;
  int cents = 0;&lt;br /&gt;
   pay = 10;&lt;br /&gt;
   hours = 11;&lt;br /&gt;
   dollars = (int)(pay/hours);&lt;br /&gt;
   cents = (int)(100.0*(pay/hours - dollars) +0.5);&lt;br /&gt;
   printf(&amp;quot;Your average hourly pay rate is %d dollars and %d cents.\n&amp;quot;,&lt;br /&gt;
     dollars, cents);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Calculating the area of a room==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  double length = 0.0;&lt;br /&gt;
  double width = 0.0;&lt;br /&gt;
  long feet = 0L;&lt;br /&gt;
  long inches = 0L;&lt;br /&gt;
  const long inches_per_foot = 12L;&lt;br /&gt;
  const double inches_per_yard = 36L;&lt;br /&gt;
   feet = 9;&lt;br /&gt;
   inches = 11;&lt;br /&gt;
   length = (feet*inches_per_foot+inches)/inches_per_yard;&lt;br /&gt;
   feet = 20;&lt;br /&gt;
   inches = 3;&lt;br /&gt;
   width = (feet*inches_per_foot+inches)/inches_per_yard;&lt;br /&gt;
   /* Output the area */&lt;br /&gt;
   printf(&amp;quot;The area of the room is %.2f square yards.\n&amp;quot;,length*width);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Calculating volume price of alternative products==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  double total_price = 0.0;&lt;br /&gt;
  int type = 0;&lt;br /&gt;
  int quantity = 0;&lt;br /&gt;
  const double type1_price = 3.50;&lt;br /&gt;
  const double type2_price = 5.50;&lt;br /&gt;
   type = 9;&lt;br /&gt;
   quantity = 12.12;&lt;br /&gt;
   total_price = quantity*(type1_price + (type-1)*(type2_price-type1_price));&lt;br /&gt;
   printf(&amp;quot;The price for %d of type %d is $%.2f\n&amp;quot;,quantity, type, total_price);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Convert double to int==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  int i;&lt;br /&gt;
  long double ld;&lt;br /&gt;
  ld = 10.0;&lt;br /&gt;
  i = ld; /*convert double to int*/&lt;br /&gt;
  printf(&amp;quot;%d&amp;quot;, i);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Double calculation: square  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  double i;&lt;br /&gt;
  for(i = 1.0; i &amp;lt; 101.0; i++) {&lt;br /&gt;
    printf(&amp;quot;square root of %lf = %lf\n&amp;quot;, i, sqrt(i));&lt;br /&gt;
    &lt;br /&gt;
    printf(&amp;quot;Whole number part = %d &amp;quot;, (int)sqrt(i));&lt;br /&gt;
    &lt;br /&gt;
    printf(&amp;quot;Fractional part = %lf\n&amp;quot;, sqrt( i ) - (int) sqrt( i ));&lt;br /&gt;
    &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Table of reciprocals, squares, cubes, and fourth powers==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  double num[11][5];&lt;br /&gt;
  double value = 0.0;&lt;br /&gt;
  int y = 0;&lt;br /&gt;
  int x = 0;&lt;br /&gt;
&lt;br /&gt;
  for(y = 0, value = 3.0 ; y&amp;lt;11 ; y++, value += 0.3)&lt;br /&gt;
    num[y][0] = value;&lt;br /&gt;
  for(y = 0 ; y&amp;lt;11 ; y++)&lt;br /&gt;
  {&lt;br /&gt;
    num[y][1] = 1.0/num[y][0];&lt;br /&gt;
    num[y][2] = num[y][0]*num[y][0];&lt;br /&gt;
    num[y][3] = num[y][0]*num[y][0]*num[y][0];&lt;br /&gt;
    num[y][4] = num[y][0]*num[y][0]*num[y][0]*num[y][0];&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;\n         x&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;         1/x&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;        x*x&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;         x*x*x&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;      x*x*x*x&amp;quot;);&lt;br /&gt;
  for(y = 0 ; y&amp;lt;11 ; y++)&lt;br /&gt;
  {&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    for(x = 0 ; x&amp;lt;5 ; x++)&lt;br /&gt;
      printf(&amp;quot;%15.4lf&amp;quot;, num[y][x]);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>