WAP to find smaller number among three int numbers using PRIVATE member function.
#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;
}
Comments
Leave a comment