Function call in C++.


 #include<iostream.h>

#include<conio.h>

class add

{

int a, b, sum;

public:

void get( )

{

cout<<"Enter the number for a";

cin>>a;

cout<<"Enter the number for b";

cin>>b;

sum=a+b;

cout<<"sum is:"<<sum;

}

};

int main( )

{

add obj;

obj.get( );

getch( );

return 0;

}


To run:












Output:






No comments:

Post a Comment

theengineerschoice01@gmail.com