1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
#include <iostream> //c++ streaming I/O
#include <cstdio> //c standard I/O
using namespace std; //names reference
//declare functions
int getnum(int min, int max); //gets and Validates Users input
int sum (int num1, int num2); //adds two numbers, return sum
int difference(int num1, int num2); //subracts two numbers, return difference
int product(int num1, int num2) ; //multiplys two numbers, return product
int quotient(int num1, int num2); //divides two numbers, return quotient
int remainder(int num1, int num2); //divides two numbers, return remainder
int main ()
{
//varible declarations
int input1; //user entry
int input2; //user entry
//describe program and get input
cout<<"\nThis program Adds, Subtracts, Multiplys & Divides #'s between 1 & 12\n";
getnum(input1,input2);
sum(input1, input2);
cout << endl<<endl; //blank line
system("pause"); //keep command window open
return 0; //end program
}
//Functions
int getnum(int min, int max) // Gets and Validates Users input
{
do{
cout <<"\nEnter first number between 1 and 12: ";
cin >>min;
}while(!(min>=1 && min<=12));
do{
cout <<"\nEnter second number between 1 and 12: ";
cin >>max;
}while(!(max>=1 && max<=12));
}
int sum(int num1, int num2) //adds two numbers, return sum
{
return num1+num2;
}
int difference(int num1, int num2) //subracts two numbers, return difference
{
return num1-num2;
}
int product(int num1, int num2) // multiplys two numbers, return product
{
return num1*num2;
}
int quotient(int num1, int num2) //divides two numbers, return quotient
{
return num1/num2;
}
int remainder(int num1, int num2) //divides two numbers, return remainder
{
return num1%num2;
}
|