How to Run a C++ Program Without Namespace?

Prerequisite: Namespace in C++

If we want to run a program without using a namespace, we have to the std keyword along with the space resolution operator (::)  in every printing line and variable declaration,

For example, 

std::cout<<"w3wiki";

Example:

C++




// C++ Program without the use of using namespace std;
#include <iostream>
#include <string>
  
int main()
{
  
    std::cout << "w3wiki";
    return 0;
}


Output

w3wiki

Example:

C++




// C++ Program without the use of using namespace std
#include <bits/stdc++.h>
  
int main()
{
  
    int a = 5;
    int b = 10;
    int c = a + b;
    std::cout << c << std::endl;
    return 0;
}


Output

15