Posts

Showing posts with the label Header Files

Standard Namespace (std) in C++

The C++ Standard Library defines its library names, including standard functions, classes, objects, and templates, in a namespace called std . The namespace std stands for Standard Namespace. It contains standard library elements such as: cout – Used to display output. cin – Used to accept input. endl – Used to insert a new line and flush the output stream. string – Used to declare string objects. vector – Used to create dynamic arrays. sort() – Used to sort elements. C++ Standard Library अपने Library Names जैसे Functions, Classes, Objects और Templates को std नामक Namespace में परिभाषित करती है। std का अर्थ Standard Namespace है। इसमें Standard Library के अनेक Elements उपलब्ध होते हैं, जैसे cout , cin , endl , string , vector और sort() आदि। Using the Standard Namespace ( using namespace std ) The statement using namespace std; allows programmers to access names from the standard namespace without writing the std:: prefix every time. It is generally written after the header...

Header Files and Namespaces in C++

What is a Header File? (Header File क्या है?) A header file is a file that contains declarations of functions, classes, templates, constants, and other program elements. Header files allow programmers to use the facilities provided by the C++ Standard Library or their own reusable code. Header files are generally included in a C++ program using the #include preprocessor directive. Header File एक ऐसी File होती है जिसमें Functions, Classes, Templates, Constants तथा अन्य Program Elements की Declarations होती हैं। Header Files की सहायता से Programmer C++ Standard Library या स्वयं द्वारा बनाई गई Reusable Code सुविधाओं का उपयोग कर सकता है। Header File को C++ Program में शामिल करने के लिए #include Preprocessor Directive का उपयोग किया जाता है। Syntax: #include <header_file> Examples: #include <iostream> #include <string> #include <cmath> #include <iomanip> Some commonly used C++ header files are: Header File Purpose <iostream> Input and output operations ...

Basic Program Structure of C++ (C++ प्रोग्राम का स्ट्रक्चर)

Every C++ program consists of different sections that perform specific tasks. These sections may be written in a single source file or organized into multiple files for better program organization and reusability. A general structure of a C++ program is shown below: प्रत्येक C++ प्रोग्राम में अलग-अलग भाग होते हैं, जो विशेष कार्य करते हैं। इन भागों को एक ही Source File में लिखा जा सकता है या प्रोग्राम को बेहतर तरीके से व्यवस्थित करने तथा दोबारा उपयोग करने के लिए अलग-अलग Files में रखा जा सकता है। C++ प्रोग्राम का सामान्य प्रारूप निम्नलिखित है: General Structure of a C++ Program ------------------------------------------------ 1. Include Files (Header Files) 2. Global Declarations - Global Variables - Constants - Function Prototypes 3. Class Declaration - Data Members - Member Function Declarations 4. Member Function Definitions - Definitions of Class Member Functions 5. Main Function - Variable Declarations - Executable Statements - Function Calls 6. Other Func...