Skip to main content

C++ Lec-1 (Introduction to Programming Languages)

 

Introduction to Programming Languages

________________________________________________________________________

Programming languages are formal languages comprising a set of instructions that produce various kinds of output. They are used in computer programming to implement algorithms and control the behavior of machines.

Language Generation

Programming languages have evolved through several generations:

  1. First Generation (1GL): Machine language, the most basic level of programming languages, consisting of binary code.
  2. Second Generation (2GL): Assembly language, a low-level language with a strong correspondence to the machine language instructions.
  3. Third Generation (3GL): High-level languages like C, C++, Java, Python, which are more abstract and easier for humans to understand.
  4. Fourth Generation (4GL): Languages closer to human language, often used for database querying and report generation (e.g., SQL).
  5. Fifth Generation (5GL): Languages used for artificial intelligence and neural networks (e.g., Prolog).

History of C++

C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, incorporating object-oriented features. It was first released in 1985 and has since undergone several updates to include modern programming practices and paradigms.

Tools and Editors for C++ Programming

  1. IDEs (Integrated Development Environments):
    • Visual Studio: A comprehensive IDE from Microsoft.
    • CLion: A cross-platform IDE for C++ development from JetBrains.
    • Code::Blocks: An open-source, cross-platform IDE. And many more…
  2. Text Editors:
    • Visual Studio Code: A versatile and popular code editor.
    • Sublime Text: A sophisticated text editor for code, markup, and prose.
    • Notepad++: A free source code editor and Notepad replacement.  And many more…

 

 

Compilers

  • GCC (GNU Compiler Collection): A standard compiler for many Unix-like systems.
  • Clang: A compiler front end for the C, C++, and Objective-C programming languages.
  • Microsoft C++ (MSVC): The compiler provided with Microsoft Visual Studio.
  •  

Basics of Programming Fundamentals in C++

 1. Structure of a C++ Program

2. Comments

3. Data Types

4. Variables and Constants

5. Input and Output

6. Operators

7. Control Structures

  • If-else statements:
  • Switch statement:
  • Loops:
    • For loop:
    • While loop:
    • Do-while loop:

8. Functions

  • Function declaration:
  • Function definition:

9. Arrays

10. Pointers

11. Structure

12. Union

13. Enum

 

Flow of Code

  1. Preprocessing: Preprocessor directives (e.g., #include, #define) are resolved.
  2. Compilation: Source code is compiled into object code.
  3. Linking: Object code is linked with libraries to create an executable.
  4. Execution: The program is run, and the output is generated.

 

 References

  1. Books:
    • "The C++ Programming Language" by Bjarne Stroustrup
    • "Effective C++" by Scott Meyers
    • "C++ Primer" by Stanley B. Lippman, Josée Lajoie, and Barbara E. Moo
    • “Let us C and CPP” by Yashwant Kanitkar
    • Personally, I suggest : “C in Depth” by Shrivastava 
  1. Online Resources:
    • cplusplus.com
    • GeeksforGeeks C++ Programming Language
    • Codecademy C++ Course
    • W3School
  2. Compiler Documentation:
    • GCC Documentation
    • Clang Documentation

 

Comments

Popular posts from this blog

C++ Lec-2 Introduction to Object-Oriented Programming (OOP) in C++

  Introduction to Object-Oriented Programming (OOP) in C++ Object-Oriented Programming (OOP) is a programming paradigm that uses objects and classes to organize software design. It allows for modelling real-world entities and relationships in a program. C++ is an object-oriented programming language that provides features to implement OOP concepts effectively. Key Concepts of OOP   Class and Object o    Class : A blueprint for creating objects. It defines properties and behaviours of objects.   class Car { public:     string brand;     string model;     int year; };   o    Object : An instance of a class.   Car car1; car1.brand = "Mahindra"; car1.model = "THAR"; car1.year = 2024;   Encapsulation o    Encapsulation is the bundling of data and methods that operate on that data within a single unit, or class. It restricts direct acces...

Difference Between POP and OOP

  What is the Difference Between POP and OOP? Procedure-Oriented Programming (POP) and Object-Oriented Programming (OOP) are two fundamental programming paradigms. Both have their own methodologies, approaches, and use cases. Below, we will define both paradigms, outline their key differences, and provide examples of each for better understanding.   Definition of POP (Procedure-Oriented Programming) Procedure-Oriented Programming (POP) is a programming paradigm where programs are designed around procedures or functions. It focuses on dividing the program into smaller units called functions, which operate on data. Key Features of POP: Program is divided into functions or procedures. Functions are the main building blocks of the program. Emphasizes a step-by-step procedural approach. Data and functions are separate, with functions manipulating data.   Definition of OOP (Object-Oriented Programming) Object-Oriented Programming (OOP) is a p...