Biggest and smallest from three given numbers in c++

  • on February 4, 2019
  • Likes!
Hello friends! Welcome to my website
C++ programming to find the biggest and the smallest number between two numbers?
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

Find the biggest and the smallest number from three given numbers in c++

#include <iostream>
#include <cmath>
using namespace std;

class Test {
public:
    int a, b,c;

    void biggest(int a, int b, int c) {
       if(a>b && a>c){
   cout<<a <<“if biggest than “<< b <<” and ” <<c;
   }
   else if(b>a && b>c){
   cout<<b <<“if biggest than “<< a <<” and ” <<c;
   }
   else{
        cout<<c <<“if biggest than “<< a <<” and ” <<b;
   }
    }
void smallest(int a, int b, int c) {
       if(a<b && a<c){
   cout<<a <<“if smallest than “<< b <<” and ” <<c;
   }
   else if(b<a && b<c){
   cout<<b <<“if smallest than “<< a <<” and ” <<c;
   }
   else{
        cout<<c <<“if smallest than “<< a <<” and ” <<b;
   }
    }
};

int main() {

    Test o;
    cout << “Please Enter the frist number: “;
    cin >> o.a;
    cout << “Please Enter the second Number: “;
    cin >> o.b;
cout << “Please Enter the third Number: “;
    cin >> o.b;
    cout <<“—————–” << endl;
o.biggest(o.a, o.b, o.c);
    cout <<“—————–” <<endl;
    o.biggest(o.a, o.b, o.c);
    return 0;
}

  Output:
    Please Enter the frsit number: 12
Please Enter the second number: 15
Please Enter the third number: 11
—————–
15 is  biggest than 12 and 11
—————–
11 is  smallest than 12 and 15

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 doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.

Please share your experience about this post,
Thank You!

Article Categories:
Programs in cpp

Leave a Reply

Your email address will not be published. Required fields are marked *