Answer to Question #230068 in C++ for Arup

Question #230068

WAP to find smaller number among three int numbers using PRIVATE member function.


1
Expert's answer
2021-08-26T23:50:17-0400
#include <iostream>
using namespace std;
class Number{
    int a, b, c;
    public:
    Number(){
        cout<<"Input the three integers: ";
        cin>>a>>b>>c;
    }
    int findSmaller(){
        int x = a < b ? a : b;
        return x < c ? x : c;
    }
};
int main(){
    Number n;
    cout<<n.findSmaller();
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS