Categories
C++

Addition and Subtraction Using Function in C++

 I wrote this program to ask the user to give two numbers and then the program will compute the sum and difference of the two numbers using functions in C++ programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.
Here in Bacolod City I also accepting computer repair, networking and Arduino Project development at a very affordable price.

Program Listing

/*  add_subtraction.cpp
    Author   : Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
    Date     : October 13, 2020  Tuesday  9:08 PM
    Tools    : CodeBlocks IDE and C++ Compiler
    Website  : www.jakerpomperada.com / www.jakerpomperada.blogspot.com
    Email    : jakerpomperada@gmail.com
    Location : Bacolod City, Negros Occidental Philippines.
*/

#include <iostream>

using namespace std;

int addition(int a, int b)
{
   return(a+b);
}

int subtraction(int c, int d)
{

  return(c-d);

}

int main(void) {

    int x=0,y=0;

    cout <<"\n\n";
    cout << "\tAddition and Subtraction Using Function in C++";
    cout <<"\n\n";
    cout <<  "\tGive Two Numbers : ";
    cin >> x >> y;
    cout <<"\n\n";
    cout <<"\tDisplay Results";
    cout <<"\n\n";
    cout <<"\tThe sum of " << x << " and " << y << " is "
         << addition(x,y) << ".\n\n";
    cout <<"\tThe difference between " << x << " and " << y << " is "
         << subtraction(x,y) << ".\n";
    cout <<"\n\n";
    cout <<"\tEnd of Program";
    cout <<"\n\n";

}

Leave a Reply

Your email address will not be published. Required fields are marked *