How to Run a C++ Program Without Namespace? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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++ // C++ Program without the use of using namespace std; #include <iostream> #include <string> int main() { std::cout << "geeksforgeeks"; return 0; } Outputgeeksforgeeks 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; } Output15 Comment More info R raj2002 Follow Improve Article Tags : Technical Scripter C++ Programs C++ Technical Scripter 2022 Explore C++ BasicsIntroduction to C++3 min readData Types in C++7 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++5 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++11 min readFile Handling through C++ Classes8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++10 min readPolymorphism in C++5 min readEncapsulation in C++4 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL3 min readIterators in C++ STL10 min readC++ STL Algorithm Library2 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like