// july23ex1.cpp : Defines the entry point for the console application.
// this demonstrates the use of functions

#include "stdafx.h"
//first, the prototypes of all the functions we will use:

int add_it (int, int);
int sub_it (int, int);
int mult_it (int, int);
int div_it (int, int);


int main(int argc, char* argv[])
{

    int oper, num1, num2, result;

	printf("Type operator, num1, num2 on each line\n");

    scanf("%d", &oper);
	while ( (oper >=1) && (oper<=4))  {

      scanf("%d %d", &num1, &num2);

	  switch(oper)  {
	    case 1: result = add_it (num1, num2); break;
	    case 2: result = sub_it (num1, num2); break;
		case 3: result = mult_it (num1, num2); break;
		case 4: result = div_it (num1, num2); break;

	  } /* end switch oper */

     printf("\nResult is %d \n", result);
	 printf("Type in next group\n");

     scanf("%d", &oper);
	}  /* end while oper */



	return 0;
}  /*end function main */


int add_it (int n1, int n2)  {
   int result;
   result= n1 + n2;
   return result;

}  /* end function add_it  */

int sub_it (int n1, int n2)  {
   int result;
   result= n1 - n2;
   return result;

}  /* end function sub_it  */


int mult_it (int x1, int x2)  {
   int arrgh;
   arrgh= x1 * x2;
   return arrgh;

}  /* end function mult_it  */

int div_it (int n1, int n2)  {
   int result;
   result= n1 / n2;
   return result;

}  /* end function div_it  */