Results for “read lines”
Small, practical examples. Search by task or narrow things down below.
Find the least common multiple with the standard library
C++: std::lcm combines positive integer periods into a common cycle.
C++✓ Tested
Find the nearest matching ancestor
Read a parent row attribute using jQuery closest.
jQuery✓ Tested
Find the next chosen weekday
Java: TemporalAdjusters.next excludes the starting day even if it already has that weekday.
Java✓ Tested
Find what remains after division
C++: Use the remainder operator to count items left after forming complete groups.
C++✓ Tested
Format an integer into a caller-owned buffer
C++: to_chars avoids allocation and reports whether the buffer was large enough.
C++✓ Tested
Group matching values while preserving their order
C++: stable_partition keeps the relative order within both predicate groups.
C++✓ Tested
Handle a failed file open through stream state
C++: An unopened input stream is not an empty successful file read.
C++✓ Tested
Handle a failed string-to-integer conversion
C++: stoi throws invalid_argument when no conversion can be performed.
C++✓ Tested
Handle three possible outcomes
C++: Check high, normal and low values with an ordered conditional chain.
C++✓ Tested
Ignore generated files
Exclude build output from untracked-file listings.
gitignore✓ Tested
Increment a shared counter safely
C++: Atomic increments prevent lost updates when two threads change the same counter.
C++✓ Tested
Increment a stored value in the database
SQL: An in-database arithmetic update avoids a separate application read-modify-write step.
SQL✓ Tested