Hello friends! Welcome to Programming Shortcut
C++ programming to find the bigger and smaller number between two numbers?
This c++ language programming is free of all types 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
#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 first number: “;
cin >> o.a;
cout << “Enter the second Number: “;
cin >> o.b;
cout << “The Result is following:” << endl;
o.bigger(o.a, o.b);
o.smaller(o.a, o.b);
return 0;
}
output:
Enter the first number: 4
Enter the second Number: 8
The result is following:
8 is bigger than 4
4 is smaller than 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 questions about c++ programming send an email by contacting us form are given on page right side.
Thank You!