Advertisement
atm-irbis

reading from stdin

May 6th, 2014
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 1.18 KB | None | 0 0
  1. readf("%s", &studentCount);
  2.      
  3.  
  4.     import std.stdio;
  5.      
  6.     void main()
  7.     {
  8.         write("How many students are there? ");
  9.      
  10.         /*
  11.          * Определение переменной, которая будет использоваться для
  12.          * хранения информации, которая считывается со входа.
  13.          */
  14.         int studentCount;
  15.      
  16.         // Сохранение входных данных для данной переменной
  17.         readf("%s", &studentCount);
  18.      
  19.         writeln("Got it: There are ", studentCount, " students.");
  20.     }
  21.      
  22.  
  23.  
  24.     import std.stdio;
  25.      
  26.     void main()
  27.     {
  28.         write("How many students are there? ");
  29.         int studentCount;
  30.         readf("%s", &studentCount);
  31.      
  32.         write("How many teachers are there? ");
  33.         int teacherCount;
  34.         readf("%s", &teacherCount);
  35.      
  36.         writeln("Got it: There are ", studentCount, " students",
  37.                 " and ", teacherCount, " teachers.");
  38.     }
  39.      
  40.  
  41.  
  42.     // ...
  43.         readf(" %s", &studentCount);
  44.     // ...
  45.         readf(" %s", &teacherCount);
  46.     // ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement