#include #include #include int main(int argc, char **argv) { int c, ans; while((c = getopt(argc, argv, "asmdo:p:")) != -1) { switch(c) { case 'a': ans = optarg[1] + optarg[2]; case 's': ans = optarg[1] - optarg[2]; case 'm': ans = optarg[1] * optarg[2]; case 'd': ans = optarg[1] / optarg[2]; } printf("The answer is %d\n", ans); } return 0; }