C Tutorial/printf scanf/scanf field width — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 13:32, 25 мая 2010

inputting data with a field width

<source lang="cpp">#include <stdio.h> int main() {

  int x; 
  int y; 
  
  printf( "Enter a six digit integer: " );
  scanf( "%2d%d", &x, &y );
  printf( "The integers input were %d and %d\n", x, y );
  return 0; 

}</source>

Enter a six digit integer: 1
2
The integers input were 1 and 2