Grade 9 · 5 algorithmsCitește în română
Text filesFișiere text
Every text files algorithm from the Romanian high school curriculum, with the idea explained, its complexity, examples and code you can edit and run right here.
- 5algorithms
- 8chapters
- 1grade
5 algorithms
0%
Text files
Fișiere text · 5 algorithms
- Reading until the end of the fileCitirea până la sfârșitul fișieruluiThe file date.in contains integers, but we do not know how many. The expression fin >> x returns 'true' as long as reading succeeds and 'false' at…
- Counting the values in a fileNumărarea valorilor dintr-un fișierThe file date.in contains a natural number k on the first line, and on the following lines a sequence of natural numbers of unknown length. We read…
- Processing a file line by linePrelucrarea unui fișier pe liniigetline(fin, linie) reads a whole line, spaces included, up to '\n'. The loop while (getline(fin, linie)) stops at the end of the file. We count the…
- Formatted writing to a fileScrierea formatată într-un fișiern is read from date.in and the numbers from 1 to n are written to date.out, five per line. ofstream is used exactly like cout; a new line is written…
- Sum of the numbers on each lineSuma numerelor de pe fiecare linieEvery line of date.in contains a few integers, an unknown number of them. We read the line with getline, then 're-read' it as a stream of numbers…