#include <stdio.h>
int plus(int a, int b) { return a + b; }
int minus(int a, int b) { return a - b; }
int main(int argc, const char * argv[])
{
int valuea = 0; //数値A
int valueb = 0; //数値B
int command = 0; //コマンド
int anser = 0; //答え
scanf("%d",&valuea
); //数値Aに代入 scanf("%d",&valueb
); //数値Bに代入 printf("\n実行する計算のコマンドを入力してね\n"); scanf("%d",&command
); //変数commandに代入
if (command == 1) anser = plus(valuea,valueb);//コマンドが1ならばobject関数に足し算をするようにメソッドを送る
else if (command == 2) anser = minus(valuea, valueb);//コマンドが2ならばobject関数に引き算をするようにメソッドを送る
//object関数から帰ってきた計算の答えを変数anserに代入する
printf("\n答えは%dになりましたとさ。",anser
); //答えが入っている変数anserを標準出力
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgcGx1cyhpbnQgYSwgaW50IGIpIHsgcmV0dXJuIGEgKyBiOyB9CmludCBtaW51cyhpbnQgYSwgaW50IGIpIHsgcmV0dXJuIGEgLSBiOyB9CgppbnQgbWFpbihpbnQgYXJnYywgY29uc3QgY2hhciAqIGFyZ3ZbXSkKewogICAgaW50IHZhbHVlYSA9IDA7IC8v5pWw5YCkQQogICAgaW50IHZhbHVlYiA9IDA7IC8v5pWw5YCkQgogICAgaW50IGNvbW1hbmQgPSAwOyAvL+OCs+ODnuODs+ODiQogICAgaW50IGFuc2VyID0gMDsgLy/nrZTjgYgKICAgIAogICAgcHJpbnRmKCLmlbDlgKRB44KS5YWl5Yqb44GX44Gm44GtXG4iKTsKICAgIHNjYW5mKCIlZCIsJnZhbHVlYSk7IC8v5pWw5YCkQeOBq+S7o+WFpQogICAgcHJpbnRmKCJcbuaVsOWApELjgpLlhaXlipvjgZfjgabjga1cbiIpOwogICAgc2NhbmYoIiVkIiwmdmFsdWViKTsgLy/mlbDlgKRC44Gr5Luj5YWlCiAgICBwcmludGYoIlxu5a6f6KGM44GZ44KL6KiI566X44Gu44Kz44Oe44Oz44OJ44KS5YWl5Yqb44GX44Gm44GtXG4iKTsKICAgIHByaW50Zigi44Gf44GX44GW44KTPT0xIOW8leOBjeeulz09MlxuIik7CiAgICBzY2FuZigiJWQiLCZjb21tYW5kKTsgLy/lpInmlbBjb21tYW5k44Gr5Luj5YWlCiAgICAKICAgIGlmIChjb21tYW5kID09IDEpIGFuc2VyID0gcGx1cyh2YWx1ZWEsdmFsdWViKTsvL+OCs+ODnuODs+ODieOBjO+8keOBquOCieOBsG9iamVjdOmWouaVsOOBq+i2s+OBl+eul+OCkuOBmeOCi+OCiOOBhuOBq+ODoeOCveODg+ODieOCkumAgeOCiwogICAgZWxzZSBpZiAoY29tbWFuZCA9PSAyKSBhbnNlciA9IG1pbnVzKHZhbHVlYSwgdmFsdWViKTsvL+OCs+ODnuODs+ODieOBjDLjgarjgonjgbBvYmplY3TplqLmlbDjgavlvJXjgY3nrpfjgpLjgZnjgovjgojjgYbjgavjg6Hjgr3jg4Pjg4njgpLpgIHjgosKICAgIC8vb2JqZWN06Zai5pWw44GL44KJ5biw44Gj44Gm44GN44Gf6KiI566X44Gu562U44GI44KS5aSJ5pWwYW5zZXLjgavku6PlhaXjgZnjgosKICAgIAogICAgcHJpbnRmKCJcbuetlOOBiOOBryVk44Gr44Gq44KK44G+44GX44Gf44Go44GV44CCIixhbnNlcik7IC8v562U44GI44GM5YWl44Gj44Gm44GE44KL5aSJ5pWwYW5zZXLjgpLmqJnmupblh7rlipsKICAgIAogICAgcmV0dXJuIDA7Cn0K