Lesson 3

Cards (33)

  • A C++ program is a collection of text that commands a computer to perform algorithms
  • Programming Language: Set of rules and syntax used to describe a program
  • Low-Level Language: Easily interpretable by computers (e.g., machine language, assembly language)
  • High-Level Language: Resembles human language, reduces user awareness of hardware (e.g., C++, Java)
  • C++ Language: General-purpose programming language with a bias towards systems programming
  • C++ supports data abstraction, is a better C, and supports generic and object-oriented programming
  • C++ is case sensitive
  • Pre-processor Directive locates the file with code for the <iostream> library
  • Main Function is the entry point for program execution
  • Curly Braces define the body of the program
  • Closing Curly Brace ends a function or method when a value is expected to be returned
  • Source Code is written in a high-level language, saved with a .cpp extension
  • Preprocessor Directives are statements processed by the preprocessor
  • Common header files include <iostream>, <cmath>, <iomanip>
  • Compiler checks for syntax errors, translates the source program into machine language
  • Linker combines object program with other programs in the library
  • Primitive Data Types are built-in or predefined (e.g., int, float, double, bool, char)
  • String is a sequence of characters enclosed in double quotation marks
  • C Strings are one-dimensional arrays of characters, terminated by a null character '\0'
  • String Functions:
    • strcat: Concatenates two strings
    • strncat: Concatenates up to n characters of one string onto another
    • strcmp: Compares two strings lexicographically
    • strcpy: Copies one string into another
    • strncpy: Copies up to n characters of one string into another
    • strlen: Returns the length of a string
  • Function is a block of code defined to perform a specific task
  • Array is a collection of items stored at continuous memory locations
  • Pointers are symbolic representations of addresses, enabling call-by-reference and dynamic data manipulation
  • Abstract Data Types are user-defined data types (e.g., class, structure, union, enumeration)
  • Operators are symbols denoting calculation, relationship, comparison, and operations on operands
  • Constant is a memory location with unchangeable content during program execution
  • Identifiers consist of letters, digits, and underscores, must start with a letter or underscore
  • C++ Statements include declaration statements used to declare variables and executable statements that perform calculations, manipulate data, create output, accept input, etc
  • Output Stream is the flow of bytes from main memory to display, while Input Stream is the flow of bytes from the keyboard to main memory
  • Escape Sequences are special characters modifying output format
  • Expression is a combination of values, variables, and operators
  • Casting is explicit type conversion using static_cast
  • Visualize the problem using a flowchart, translate into pseudocodes, and write equivalent C++ codes for each pseudocode