Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# syntax: AWK -f TEMPERATURE_CONVERSION.AWK
BEGIN {
while (1) {
printf("\nKelvin degrees? ")
getline K
if (K ~ /^$/) {
break
}
if (K < 0) {
print("K must be >= 0")
continue
}
printf("K = %.2f\n",K)
printf("C = %.2f\n",K - 273.15)
printf("F = %.2f\n",K * 1.8 - 459.67)
printf("R = %.2f\n",K * 1.8)
}
exit(0)
}

View file

@ -0,0 +1,19 @@
# usage: gawk -f temperature_conversion.awk input.txt -
BEGIN { print("# Temperature conversion\n") }
BEGINFILE { print "# reading", FILENAME
if( FILENAME=="-" ) print "# Please enter temperature values in K:\n"
}
!NF { exit }
{ print "Input:" $0 }
$1<0 { print("K must be >= 0\n"); next }
{ K = 0+$1
printf("K = %8.2f Kelvin degrees\n",K)
printf("C = %8.2f\n", K - 273.15)
printf("F = %8.2f\n", K * 1.8 - 459.67)
printf("R = %8.2f\n\n",K * 1.8)
}
END { print("# Bye.") }