How to Run a C++ Program Without Namespace?
Last Updated :
02 Nov, 2022
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<<"geeksforgeeks";
Example:
C++
#include <iostream>
#include <string>
int main()
{
std::cout << "geeksforgeeks" ;
return 0;
}
|
Example:
C++
#include <bits/stdc++.h>
int main()
{
int a = 5;
int b = 10;
int c = a + b;
std::cout << c << std::endl;
return 0;
}
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...