Namespace

#include <iostream>
using namespace std;
namespace int_var{
          int i=7;
          int k=8;
          }
namespace double_var{
          double j=7.5;
          double l=8.5;
          }
int main()
{
    cout<<int_var::i<<"\t"<< int_var::k<<endl;
    cout<<double_var::j<<"\t"<< double_var::l<<endl;
    system("pause");
    return 0;
}


This is the output:
7       8
7.5     8.5

0 comments:

Post a Comment