VB icon

Addition of Two Numbers Using Pointers and Classes in C++

Email
Submitted on: 8/31/2015 4:29:56 AM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: C++ (general)
Views: 2956
author picture
 
     A simple program that I wrote in C++ that will ask the user to enter a number and then our program will find the sum of two numbers using pointers and classes as our data structure in C++ programming. If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360. Thank you very much and Happy Programming.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Addition of Two Numbers Using Pointers and Classes in C++
// Description:A simple program that I wrote in C++ that will ask the user to enter a number and then our program will find the sum of two numbers using pointers and classes as our data structure in C++ programming.
If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
// By: Jake R. Pomperada
//**************************************

#include <iostream>
using namespace std;
class add {
public:
int a,b;
 int convert(int *a, int *b )
 {
 return(*a+*b);
 }
};
 main() {
add values;
char reply;
 while (1) {
system("cls");
cout << "\n\n\t Addition Program Using Class and Pointers ";
cout << "\n\n \t Created By: Mr. Jake R. Pomperada, MAED-IT";
cout << "\n";
cout << "\n\n Enter the first value : ";
cin >> values.a;
cout << "\n Enter the second value : ";
cin >> values.b;
cout << "\n\n";
cout << " The total sum is ";
cout << values.convert(&values.a,&values.b);
cout << ".";
cout <<"\n\n";
cout << " More Y/N :=> ";
cin >> reply;
if (reply == 'N' || reply == 'n') {
cout << "\n\n";
cout << "\t Thank You For Using This Program :-D";
break;
}
}
cout << "\n\n\n\n";
system("pause");
}


Other 69 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

11/26/2015 10:41:56 AMZuoge Zhang

if you declare your variables in "private" at your class,will it work?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.