4/01/2009

C++ Program To Find The Biggest Of 3 Given Numbers


/* C++ Program To Find The Biggest Of 3 Given Numbers */

#include <iostream>

using namespace std;

class Number
{
    int a,b,c;
public:
    void getdata();
    void showdata();
};
void Number::getdata()
{
    cout<<"Enter three Numbers:\n";
    cin>>a>>b>>c;
}
void Number::showdata()
{
    if((a>b)&&(a>c))
        cout<<"Biggest Number:"<<a<<endl;
    else if((b>a)&&(b>c))
        cout<<"Biggest Number:"<<b<<endl;
    else
        cout<<"Biggest Number:"<<c<<endl;
}

int main()
{
    Number m1;
    m1.getdata();
    m1.showdata();

    return 0;
}
Out Put:
Enter three Numbers:
54
58
98
Biggest Number:98

No comments:

Post a Comment