Prints a table of conversions from inches to centimeters at every half inch. 半インチ毎のインチ〜センチメートルの変換表を表示する。
- /* Working up a shoe size conversion chart.
- // 靴サイズの変換を表にまとめましょう。
- // By Joel Rees, February 2014.
- // ジョエル リースの2014年2月作。
- // Play with it, check out your compiler and your understanding.
- // これを使ってコンパイラの動作や自分の理解度をご確認ください。
- // いじってみて下さい。
- */
- #include <stdio.h>
- #include <stdlib.h>
- int main( int argCount, char * arguments[] )
- {
- double start = 5; /* inches */
- double end = 13.6;
- double step;
- if ( argCount > 2 )
- {
- start = strtod( arguments[ 1 ], NULL );
- end = strtod( arguments[ 2 ], NULL );
- }
- printf( "%7s -- %7s\n", "inches", "cm" );
- for ( step = start; step < end; step = step + 0.5 )
- { printf( "%7.1f .. %7.1f\n", step, step * 2.54 );
- }
- return EXIT_SUCCESS;
- }