.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to add illustrate the concept of nesting of function

ad+1

Program -


#include<iostream.h>
#include<conio.h>
class abc
               {
private:
int a,b,c;
public:
void read();
void write()
{
cout<<"\n sum of two no is:"<<sum();
}
int sum()
{
c=a+b;
return(c);
}
};
void abc::read()
{
cout<<"\n enter the value of a & b:";
cin>>a>>b;
}
void main()
{
class abc m1;
clrscr();
m1.read();
m1.write();
getch();
}



Output :

 enter the value of a & b:5 7

 sum of two no is:12





0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates