Skip to content

Introduction

Machine Code, Assembly Code, High-level languages

../res/Pasted image 20240226082842.png

Compiler & Interpreter

Compiler: Program Code -> Machine Code

  • (C/C++ Compiler): Translate + Generate Executable File

Interpreter: special compiler

  • Reads and executes program directly
  • Do not generate executable file

C/C++ Code VS Assembly Code

Compilers

Popular C/C++ compilers:

  • GCC (GNU Compiler Collection)
  • MSVC (Microsoft Visual C compiler)
  • Clang
  • ICC (Intel C/C++ Compiler

Why C and C++?

  • C is a high-level language that is closest to assembly.
  • C++ "is as close to C as possible, but no closer".
  • C++ is a language that
    • is a better C,
    • supports data abstraction,
    • and supports object oriented programming.
  • C and C++ are popular, powerful, general-purpose and efficient, and play an essential role in areas like systems programming, game engines development, high frequency trading, ...

Standarlization of C and C++

👍 CS100 is based on C17 and C++17.

cppreference

Useful resources of C and C++

cppreference

The standard documentations are not friendly for learning:

  • They aim to provide a precise definition of the language, instead of teaching the language.
  • The chapters are not organized in a way suitable for learning.
  • Changes between different standards are not shown in-place.

Cppreference is a complete online reference for the C and C++ languages and standard libraries.

  • A more convenient and friendly version of the standards.

Class Information

Assessment

Homework 72% + Midterm Exam 22% + Quiz 4% + Recitation attendance checks 2%.

  • No final exams
  • No projects
  • Homework assignments make up a large proportion!

Recitations

  • About 15 recitations
  • 2 hours every week
  • Include review of important contents, some extensions, homework/quiz/exam solutions, and some coding examples.
  • Attendance mandatory! ( 2 % in total)
  • Videos will be available on Bilibili.

Homework assignments

  • 8 homework assignments:
    • 7 %+7 %+7 %+11 %+7 %+11 %+11 %+11 %= 72% (may be adjusted)
  • Submit through Online Judge!!!
    • Any other forms of submissions are not accepted, unless with special reasons.
    • For every problem, the score of the last submission will be taken as the final score.
  • No plagiarism!!! The penalty will be heavy.
    • The TAs are really experienced. Don't take any chances.

Quizzes

  • 1 or 2 quizzes, 4 % in total.
  • During regular classes
  • Time will not be announced in advance!

Midterm exam

  • 22%
  • Will be held in the 13th ~ 15th week
  • Covers everything in regular classes and recitations, unless otherwise stated.
    • Ranging from the beginning to operator overloading (C++).
  • Will not be too difficult. Don't worry.

Textbooks and References

Recommended textbooks:

  • C++ Primer (5th edition) (NOT C + + Primer Plus!) (based on C++11)
  • Effective C++ (based on C++98), Effective Modern C++ (based on C++14)
  • The C++ Programming Language (4th edition) (based on C++11), written by Bjarne Stroustrup, the inventor of C++

All of the course materials conform to the C17 and C++17 standards, based on cppreference and the standard committee's papers.

Environment Setup

  • VSCode + GCC (MinGW on Windows)
  • Advanced tools may needed