#include #include #include #include "mc.h" mypair p; main(argc, argv) int argc; char *argv[]; { CLIENT *cl; /* a client handle */ char choice[256]; int a1, a2, v; if (argc != 2){ fprintf(stderr, "Usage: %s server\n", argv[0]); exit(1); } if (!(cl = clnt_create(argv[1], MCPROG, MCVERS, "tcp"))) { /* * CLIENT handle couldn't be created, server not there. */ clnt_pcreateerror(argv[1]); exit(1); } while (1) { printf("\n\n"); printf("\n\t1. Add\n"); printf("\t2. Subtract\n"); printf("\tEnter your choice: "); scanf("%s", choice); if (strcmp(choice, "1") == 0) { printf("\nEnter the two integers to add: "); scanf("%d %d", &(p.arg1), &(p.arg2)); v = (*add_1(&p,cl)); printf("The sum is %d\n", v); }else if (strcmp(choice, "2") == 0) { printf("\nEnter the two integers to subtract: "); scanf("%d %d", &(p.arg1), &(p.arg2)); v = (*subtract_1(&p,cl)); printf("The difference is %d\n", v); } else break; } clnt_destroy(cl); printf("\nGood Bye\n");}