This simple program in C++ will show you how to multiply them using Classes. The code is very simple and easy to understand.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
Program Listing
#include <iostream>
#include <string>
using namespace std;
class multiply {
int val1,val2;
char reply;
public:
int get_data();
void display_result(void);
};
int multiply :: get_data()
{
while (1) {
system("cls");
cout << "enter two number :";
cin >> val1>> val2;
cout << "\n\n The Product is " << (val1*val2);
cout << "\n\n";
cout << "More Y Or N : ";
cin >> reply;
if (tolower(reply) == 'n') {
cout << "Thanks";
break;
}
}
}
void multiply :: display_result(void)
{
int val=0;
val = get_data();
}
main() {
multiply numbers;
numbers.display_result();
}
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
#include <iostream>
#include <string>
using namespace std;
class multiply {
int val1,val2;
char reply;
public:
int get_data();
void display_result(void);
};
int multiply :: get_data()
{
while (1) {
system("cls");
cout << "enter two number :";
cin >> val1>> val2;
cout << "\n\n The Product is " << (val1*val2);
cout << "\n\n";
cout << "More Y Or N : ";
cin >> reply;
if (tolower(reply) == 'n') {
cout << "Thanks";
break;
}
}
}
void multiply :: display_result(void)
{
int val=0;
val = get_data();
}
main() {
multiply numbers;
numbers.display_result();
}
No comments:
Post a Comment