Computer Theory Question/Answers: Q1. Explain The Structure of C++
Computer Theory Question/Answers: Q1. Explain The Structure of C++
Question/Answers
Q1. Explain the structure of C++.
=> C++ is a general-purpose, high-performance programming language
developed by Bjarne Stroustrup in 1983.
Here the structure of C++:
using namespace std; //Allows us to use names like cout, cin without
prefixing with std::
ii) Namespaces : Namespaces in C++ are a feature used to organize code into
logical groups and prevent name conflicts.
iii) Main Function : The main() function is the entry point of any C++ program.
Execution starts here.
Types of Variables:
1. Primitive Data Types:
• int: Stores integers (whole numbers) like -5, 0, 10.
• float: Stores floating-point (decimal) numbers like 3.14, -0.001.
• double: Stores double-precision floating-point numbers (more precise than
float).
• char: Stores a single character like 'a', 'B', or '9'.
• bool: Stores a boolean value (true or false).
• A const variable must be initialized when declared, and its value cannot be altered later in the
program.