Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* Adator. prog.
  + feladatsor
  + quick link

Teaching

• Prog. for Data Sci.
  ▸ exercises
  ▸ quick link

teaching assets


Félévek

* 2026/27/1
* archívum


Linkek

* kalendárium
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C#
* D lang.
* Java
* Nim
* Nim2
  + exercises
* XC=BASIC
* old
  ✦C++, ✦Clojure, ✦Scala


[ edit | logout ]
[ sandbox | passwd ]

Read lines until EOF

We want to read lines from the standard input until EOF (under Linux: until the user presses Ctrl+d, which indicates the end of the input).

Exercise: read lines until EOF and at the end print on the screen the number of lines provided by the user.

var cnt = 0
for line in stdin.lines:
  cnt += 1
#
echo cnt

Running example:

$ ./main
aa
bb
cc
<Ctrl+d>    # EOF happens here
3
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2026 November 05, 16:50