C++ programming to find the bigger and smaller number between two numbers?
This c++ language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with their output. This programming output is customized to understand easily.
Program to print the bigger and smaller number between two numbers in c++ language
#include
using namespace std;
class Test {
public:
int a, b;
void bigger(int a, int b) {
if (a > b) {
cout << a << ” is bigger then ” << b << endl;
}
else {
cout << b << ” is bigger than ” << a << endl;
}
}
void smaller(int a, int b) {
if (a < b) {
cout << a << ” is smaller then ” << b << endl;
}
else {
cout << b << ” is smaller than ” << a << endl;
}
}
};
int main() {
Test o;
cout << “Enter the frist number: “;
cin >> o.a;
cout << “Enter the second Number: “;
cin >> o.b;
cout << “Result is following:” << endl;
o.bigger(o.a, o.b);
o.smaller(o.a, o.b);
return 0;
}
Enter the frist number: 4
Enter the second Number: 8
Result is following:
8 is bigger than 4
4 is smaller then 8
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any dought about this c++ programming code or input & output please comment below
If you have other question about c++ programming send an email by contacting us form are given on page right side.
Thank You!