A very simple program to add a number using classes and pointers in C++ I wrote this code during my class C++ way back in 2010.
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.
I am currently accepting programming work, it projects, 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 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.
My personal website is http://www.jakerpomperada.com
My personal website is http://www.jakerpomperada.com
Program Listing
#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");
}
No comments:
Post a Comment