A simple program to ask the user to give two numbers and then the program will compute the sum of two numbers using function 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 at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.

Program Listing

// sum.cpp
// Jake Rodriguez Pomperada, MAED-IT, MIT
// www.jakerpomperada.blogspot.com and www.jakerpomperada.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental Philippines.

#include <iostream>

int addition(int a, int b);

int main()
{
	int a=0,b=0,sum=0;
	
	std::cout <<"\n\n";
	std::cout << "\tSum of Two Numbers Using Function in C++";
	std::cout <<"\n\n";
	std::cout <<"\tGive First Value : ";
	std::cin >> a;
	std::cout <<"\n";
	std::cout <<"\tGive Second Value : ";
	std::cin >> b;
	std::cout <<"\n";
	
	sum = addition(a,b);
	
	std::cout <<"\n";
	std::cout <<"\tThe sum of " << a << " and " 
	            << b << " is " << sum <<".";
	
  std::cout <<"\n\n\n";
  std::cout <<"\tEnd of Program";
  std::cout <<"\n";
}

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

Leave a Reply

Your email address will not be published.