Friday, 25 January 2013

Name space in c++

#include <iostream>
#include <conio>

 namespace  geo
{
const double pi=3.14159;
double circumf(double radius)
{
 return 2*pi*radius;
}
}


  void main()
  {


  double d=geo::circumf(10.2);
  cout<<d<<endl;
   getch();
   }

Related Posts:

  • operator overloading in c++ #include<iostream.h> #include<conio.h> //THE OPERATORS {DOT OPERATOR (.), SCOPE RESOLUTION OPERATOR(::), CONDITIONAL OPERATOR(?:), POINT… Read More
  • friend class in c++ #include<iostream.h> #include<conio.h> //class B;   here class b declaration is not necessary b/c in class A,      … Read More
  • employee history details in c++ //rocord of 10 employees #include<iostream.h> #include<stdio.h> #include<conio.h> class employee { private: char name[40]; char a… Read More
  • Accessibility in c++ //check the accessability of static and non static variables/functions #include<iostream.h> #include<conio.h> class test { private: sta… Read More
  • inheritance in c++ #include<iostream.h> #include<conio.h> class more1           //base/super/parent class { protected: int posit… Read More

0 comments:

Post a Comment