A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C_Tutorial%2Fprintf_scanf%2Fscanf_Basics</id>
		<title>C Tutorial/printf scanf/scanf Basics - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C_Tutorial%2Fprintf_scanf%2Fscanf_Basics"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C_Tutorial/printf_scanf/scanf_Basics&amp;action=history"/>
		<updated>2026-04-18T06:05:54Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C_Tutorial/printf_scanf/scanf_Basics&amp;diff=3774&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C_Tutorial/printf_scanf/scanf_Basics&amp;diff=3774&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:19Z</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://www.cppe.ru/index.php?title=C_Tutorial/printf_scanf/scanf_Basics&amp;diff=3775&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C_Tutorial/printf_scanf/scanf_Basics&amp;diff=3775&amp;oldid=prev"/>
				<updated>2010-05-25T10:32:36Z</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;==Pass pointer argument to scanf==&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;stdio.h&amp;gt;&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  int value = 0;&lt;br /&gt;
  int *pvalue = NULL;&lt;br /&gt;
  pvalue = &amp;amp;value;                    /* Set pointer to refer to value  */&lt;br /&gt;
  printf (&amp;quot;Input an integer: &amp;quot;);&lt;br /&gt;
  scanf(&amp;quot; %d&amp;quot;, pvalue);              /* Read into value via the pointer */&lt;br /&gt;
  printf(&amp;quot;\nYou entered %d\n&amp;quot;, value);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Input an integer: string&lt;br /&gt;
     &lt;br /&gt;
     You entered 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reading and discarding characters from the input stream==&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;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{ &lt;br /&gt;
   int month1; &lt;br /&gt;
   int day1;   &lt;br /&gt;
   int year1;  &lt;br /&gt;
   int month2; &lt;br /&gt;
   int day2;   &lt;br /&gt;
   int year2;  &lt;br /&gt;
   &lt;br /&gt;
   printf( &amp;quot;Enter a date in the form mm-dd-yyyy: &amp;quot; );&lt;br /&gt;
   scanf( &amp;quot;%d%*c%d%*c%d&amp;quot;, &amp;amp;month1, &amp;amp;day1, &amp;amp;year1 );&lt;br /&gt;
   printf( &amp;quot;month = %d  day = %d  year = %d\n\n&amp;quot;, month1, day1, year1 );&lt;br /&gt;
   &lt;br /&gt;
   printf( &amp;quot;Enter a date in the form mm/dd/yyyy: &amp;quot; );&lt;br /&gt;
   scanf( &amp;quot;%d%*c%d%*c%d&amp;quot;, &amp;amp;month2, &amp;amp;day2, &amp;amp;year2 );&lt;br /&gt;
   &lt;br /&gt;
   printf( &amp;quot;month = %d  day = %d  year = %d\n&amp;quot;, month2, day2, year2 );&lt;br /&gt;
   return 0; &lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Enter a date in the form mm-dd-yyyy: 01-01-2001&lt;br /&gt;
month = 1  day = 1  year = 2001&lt;br /&gt;
Enter a date in the form mm/dd/yyyy: 01/01/2002&lt;br /&gt;
month = 1  day = 1  year = 2002&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==scanf==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The scanf function: read information from a standard input device (keyboard).&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;scanf(&amp;quot;conversion specifier&amp;quot;, variable);&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The conversion specifier argument tells scanf how to convert the incoming data.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;scanf starts with a string argument and may contain additional arguments.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Additional arguments must be pointers.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;scanf returns the number of successful inputs.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Common Conversion Specifiers Used with Scanf&amp;lt;/p&amp;gt;&lt;br /&gt;
Conversion Specifier&lt;br /&gt;
Description&lt;br /&gt;
%d&lt;br /&gt;
Receives integer value&lt;br /&gt;
%f&lt;br /&gt;
Receives floating-point numbers&lt;br /&gt;
%c&lt;br /&gt;
Receives character&lt;br /&gt;
&lt;br /&gt;
==The scanf placeholders==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;d, i Used for signed integers; the expected argument should be a pointer to int.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
    int i = 0;&lt;br /&gt;
    int k;&lt;br /&gt;
    printf(&amp;quot;input an integer:\n&amp;quot;);&lt;br /&gt;
    i=scanf(&amp;quot;%d&amp;quot;,&amp;amp;k);&lt;br /&gt;
    printf(&amp;quot;total values inputted %d\n&amp;quot;,i);&lt;br /&gt;
    printf(&amp;quot;The input values %d\n&amp;quot;,k);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;input an integer:&lt;br /&gt;
      3&lt;br /&gt;
      total values inputted 1&lt;br /&gt;
      The input values 3&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use scanf to get input from a standard input device, such as a keyboard==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In scanf, you have to specify the address of a variable, such as &amp;amp;i, &amp;amp;j, and a list of format specifiers (%d).&lt;br /&gt;
The number of format specifiers must be the same as the number of variables.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
main(){&lt;br /&gt;
  int i,j,k;&lt;br /&gt;
  printf(&amp;quot;Input two integers and press Enter to comfirm:&amp;quot;);&lt;br /&gt;
  scanf(&amp;quot;%d%d&amp;quot;,&amp;amp;i,&amp;amp;j);&lt;br /&gt;
  k = i + j;&lt;br /&gt;
  printf(&amp;quot;sum of two numbers is %d \n&amp;quot;,k);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Input two integers and press Enter to comfirm:223&lt;br /&gt;
     2&lt;br /&gt;
     sum of two numbers is 225&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using an inverted scan set==&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;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{ &lt;br /&gt;
   char z[ 9 ]; &lt;br /&gt;
   &lt;br /&gt;
   printf( &amp;quot;Enter a string: &amp;quot; );&lt;br /&gt;
   scanf( &amp;quot;%[^aeiou]&amp;quot;, z ); &lt;br /&gt;
   printf( &amp;quot;The input was \&amp;quot;%s\&amp;quot;\n&amp;quot;, z );&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Enter a string: string&lt;br /&gt;
The input was &amp;quot;str&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using Scanf to Receive Input from a User==&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;stdio.h&amp;gt;&lt;br /&gt;
main(){&lt;br /&gt;
  int iOperand1 = 0;&lt;br /&gt;
  int iOperand2 = 0;&lt;br /&gt;
  printf(&amp;quot;\nEnter first operand: &amp;quot;);&lt;br /&gt;
  scanf(&amp;quot;%d&amp;quot;, &amp;amp;iOperand1);&lt;br /&gt;
  printf(&amp;quot;Enter second operand: &amp;quot;);&lt;br /&gt;
  scanf(&amp;quot;%d&amp;quot;, &amp;amp;iOperand2);&lt;br /&gt;
  printf(&amp;quot;The result is %d\n&amp;quot;, iOperand1+iOperand2);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Enter first operand: 1&lt;br /&gt;
      Enter second operand: 2&lt;br /&gt;
      The result is 3&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>