FIND YOUR NEXT FEW LINES

Results for “Type & reading flow”

Small, practical examples. Search by task or narrow things down below.

707 snippets foundClear filters
C++Numeric parsing & calculations

Round halfway floating-point values away from zero

C++: std::round has an explicit halfway rule different from truncation.

C++✓ Tested
C++Ownership & optional values

Run cleanup through a scoped destructor

C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.

C++✓ Tested
C++Getting Started

Run your first program

C++: Start with a complete program that prints one line. Follow the run instructions below.

C++✓ Tested
SQLSelect & filter

Select specific columns

Read only the fields a result needs.

SELECT✓ Tested
Linux CommandsFiles & permissions

Set owner-only file permissions

Linux Commands: Use chmod 600 to allow only the owner to read and write a file.

Linux Commands✓ Tested
C++Ownership & optional values

Share ownership with a counted smart pointer

C++: Copies of shared_ptr keep the owned value alive until the last owner is released.

C++✓ Tested
Linux CommandsText processing

Show the first lines of a file

Read only the first three lines of a text file, useful for checking a header or previewing a large log.

head✓ Tested
Linux CommandsSystem information

Show the Linux distribution version

Read the distribution-provided operating system name and version from os-release.

os✓ Tested
CArray transformations

Sort an integer array with qsort

C: The comparator uses relational comparisons to avoid subtraction overflow.

C✓ Tested
C++Ordering & set operations

Sort only the smallest requested prefix

C++: partial_sort orders the selected prefix without guaranteeing the order of the remainder.

C++✓ Tested
C++Ordering & set operations

Sort records by two fields

C++: Tuple comparison implements lexicographic ordering across several keys.

C++✓ Tested
C++Ownership & optional values

Store a reference in a standard container

C++: reference_wrapper preserves reference semantics while behaving like a copyable container element.

C++✓ Tested