C++ Program Structure
Header FilesClass_declaration
{
Variable
+
Methods(Functions)
};
void main()
{
classname objectname; // object created
object.functionname(); // function call
getch(); // for display
}
Now we study How to make program in C++,we take a example and In this example we have a class and this class name is class A. In this program we add two variables a and b and their result will store in variable c.Lets see how to make program.
class A
{
int a,b,c;
void ADD()
{
cout<<"Enter the numbers";
cin>>a>>b;
c=a+b;
cout<<c;
}
};
void main()
{
A t;
t.ADD();
getch();
}
No comments:
Post a Comment