Results for “Dates & precise numbers”
Small, practical examples. Search by task or narrow things down below.
Find the largest value
Check for an empty C++ vector before dereferencing max_element.
C++✓ Tested
Format a decimal amount
Use invariant culture to print a C# decimal with two places.
C#✓ Tested
Format a decimal value
Print two fractional digits with C printf.
C✓ Tested
Format a timestamp
Extract a year and month from ISO timestamp text.
strftime✓ Tested
Format a timestamp with to_char
Produce a fixed numeric date string.
to_char✓ Tested
Format decimal output
Use fixed and setprecision to print two C++ decimal places.
C++✓ Tested
Give an LED pin a constant name
Arduino / C: Use const to name the built-in LED pin and reuse it in output instructions.
Arduino / C✓ Tested
Increment a shared counter safely
C++: Atomic increments prevent lost updates when two threads change the same counter.
C++✓ Tested
Join rows in a chosen order
Aggregate text with STRING_AGG and WITHIN GROUP.
STRING_AGG✓ Tested
Join strings with a separator
Combine a list of strings into one readable string with a separator between each item.
string✓ Tested
Keep loop state by avoiding a pipeline subshell
Bash Scripts: Redirect input into a while loop so updates to a counter remain in the current shell.
Bash Scripts✓ Tested
Number rows within each group
Assign ordered row numbers with a window function.
row_number✓ Tested