演習4-6 K&R プログラミング言語C
4.3 の電卓プログラムを修正する。 演習4-6 A-Z の各文字を変数とする。R は最近に印字された値を保存する特別な読込専用変数とする。 main 関数に変数を扱う処理を追加する。 /* 省略 */ case ‘w’: /* write variable */ push(type); break; case ‘r’: /* read variable */ push(type); break; case ‘\n’: recentPrintedValue = pop(); assign_var(recentPrintedValue, ‘R’); /* 最近に印字された値を保存する */ printf("\t%.8g\n", recentPrintedValue); break; default: if (type >= ‘A’ && type <= ‘Z’) { op2 = pop(); if ((int) [...]…
続きを読む- Date : 2010/1/12
- Category : blog
- Tags : language-c
- Comments : (0)


