Sunday, July 1, 2018

Addition and Product of Two Numbers in C++

In this article I would like to share with you a programming activity that I prepare to my students in my class in computer programming 1 teaching c++ to find the sum and product of two numbers and allows the user to re run again the program. I am using Dev C++ in writing this program I hope you will find my work useful.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.




Sample Program Output


Program Listing

add_product.cpp


#include <iostream>
#include <stdlib.h>

using namespace std;


int main()
{
int a,b,sum,product;
char reply;
do {
system("cls");
cout <<"\tAddition and Product of Two Numbers in C++";
cout << "\n\n";
cout << "\t Created By Mr. Jake R. Pomperada, MAED-IT";
cout << "\n\n";
cout << "Enter First Value  : ";
cin >> a;
cout << "Enter Second Value : ";
cin >> b;
sum = (a+b);
product = (a * b);
cout << "\n\n";
cout <<"The sum of " << a << " and " << b << " is " << sum << ".";
cout << "\n\n";
cout <<"The product of " << a << " and " << b << " is " << product << ".";
cout << "\n\n";
cout << "Do you want to quit? [Y] for YES  and  [N] for NO : ";
    cin >> reply;
}  while (reply == 'n' || reply == 'N');
   cout << "\n\n";
   cout << "\t Thank you for using this software";
   cout <<"\n\n";
   cout << "\t End of Program";
   cout << "\n\n";
}





No comments:

Post a Comment