my code is being compiled but the window auto close after it execute value. I can do this by using getch() also but i wanto to do it without getch() .please help.
#include <iostream.h>
#include <stdio.h>
class greatest{
private:
int x,y,z;
public:
void getdata();
void display();
int largest();
};
int greatest::largest(){
int T;
if(x>y)
T=x;
else
T=y;
if(T>z)
return(T);
else
return(z);
}
void greatest::getdata(){
cout << " Enter the value of x, y and z ";
cin >> x >> y >> z ;
};
void greatest::display(){
cout << "The greatest value is " << largest() ;
};
int main(void){
greatest A;
A.getdata();
A.display();
return 0;
}