# Calculating the sum of the difference of two intergers

// Programmer:
// Program purpose: Lab_on_For_Loops 3/14/12

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
int num1 = 0,   //assignment for intgers and bool
num2 = 0,
result,
sum = 0,
number1;
bool notevil = false;

cout <<”       1.) Get the sum of two numbers”<<endl; //starting menu
cout <<”       2.) Exit Program”<<endl;

cout <<“Enter a number from the menu to select”; //asking for a selection
cout <<endl;
cout <<endl;
cin >> number1;

switch (number1) // switches number one with a number
{
case 1: notevil = false; // switches number1 to true
break;
case 2: notevil = true;
break;
}

while(notevil == false) // if #1 is selected go into the “if” statement
{
num1 = num2 = sum = 0;

cin >> num1;

while(num2 < num1)
{
cin >> num2;
}

for(result = num2 – num1; result >= 0; result–) //declaring result as the difference between 2 numbers
{

sum += result + num1; // calculations to add the difference of the numbers

}

cout << sum <<endl; //displays teh difference of your 2 numbers

cout <<”       1.) Get the sum of two numbers”<<endl; //starting menu
cout <<”       2.) Exit Program”<<endl;

cout <<“Enter a number from the menu to select”; //asking for a selection
cout <<endl;
cout <<endl;
cin >> number1;

switch (number1) // switches number one with a number
{
case 1: notevil = false; // switches number1 to true
break;
case 2: notevil = true;
break;
}

}

system(“pause”);
return 0;
}