#include<iostream.h>
class car
{
float price;
public:
void a_price()
{
cout<<"Price :";
cin>>price;
}
};
void main()
{
car ford;
ford.a_price;
}
it will get the entry of price from user and then disappears the console and if i write getch() then it will stay why we have to write that ? this is the concept of c language. and if i write
int main ()
{
block of code
return 0;
}
then also console is disappears. and if am writing below code then console stays perfect:
#include<iostream.h>
#include<conio.h>
class car
{
float price;
public:
void a_price()
{
cout<<"Price :";
cin>>price;
}
};
void main()
{
car ford;
ford.a_price;
getch();
}
and to clear screen why we have to use system("cls"); when we have clrscr();