C Language Programming Class Notes (Part 1): Variable Assignment and Initialization, Expressions, Conditions and Branching

C Language Programming Class Notes (Part 1): Variable Assignment and Initialization, Expressions, Conditions and Branching

“ This article is compiled based on the C programming course taught by Professor Weng Kai from Zhejiang University on the China University MOOC platform. Preparation Correctly Displaying Chinese on Windows To compile C programs on Windows, you can install Dev-C++ (recommended) or MinGW (Minimalist GNU for Windows). General compilation command: gcc -o foo foo.c … Read more

Control Flow in Python: The Conductor of Program Logic

Control Flow in Python: The Conductor of Program Logic

In Python programming, control flow is a core element in constructing program logic, determining the execution process and method of the program. Mastering control flow in Python enables us to write more flexible and efficient programs. Now, let’s take a detailed look at several main control flows in Python. 1.Sequential Structure The sequential structure is … Read more

GESP C++ Level 1 Daily Problem: Buying Stationery

GESP C++ Level 1 Daily Problem: Buying Stationery

Problem Description Problem Analysis 1 Knowledge Points Input and Output Operations Variable Definition Conditional Statements 2 Problem Analysis Reading Input Cost Calculation Comparison Judgement Read four integers from standard input, representing the number of pens X, the number of notebooks Y, the number of rulers Z, and the amount of money Q that Xiao Ming … Read more

Introduction to Linux Shell (Part 4): Flow Control and Conditional Judgments

Introduction to Linux Shell (Part 4): Flow Control and Conditional Judgments

In the previous section, we wrote our first Shell script and learned how to use variables, read input, and pass parameters. In this article, we will continue to delve deeper into the “core capabilities” of Shell:Flow Control. Shell supports control structures similar to other programming languages: conditional judgments, loops, branches, etc., allowing you to write … Read more

C Language Exercise Class – Day 27

C Language Exercise Class - Day 27

01 The semicolon is a separator between C statements, not a part of the statement (True/False) Answer: False Explanation: The semicolon is an essential part of the statement. 02 The curly braces “{” and “}” can only serve as delimiters for function bodies (True/False) Answer: False Explanation: Uses of curly braces: Delimiters for functions Delimiters … Read more

C Language Exercises – Day 1

C Language Exercises - Day 1

01 Among the following statements, the correct one is ( ) A) C language programs always start executing from the first function B) In a C language program, a function to be called must be defined within the main() function C) C language programs always start executing from the main() function D) The main() function … Read more

C Language Classroom: Relational Expressions

C Language Classroom: Relational Expressions

Today, we will explore an important concept that plays the role of a judge in programming—relational expressions. 1. Explanation of Knowledge Points 1. What is a Relational Expression? In C language, a relational expression is an expression used to compare the relationship between two values. It consists of two operands (which can be variables, constants, … Read more

C Language Special: 9. Conditional Statements and Branch Control (if, else, switch)

C Language Special: 9. Conditional Statements and Branch Control (if, else, switch)

In C language, conditional judgment statements such as <span>if</span>, <span>else if</span>, <span>else</span>, and <span>switch-case</span> allow different code paths to be executed based on various conditions. This is the foundation for writing logical control programs. Before diving into the main content, let’s first review the definition and structure of functions in C language. 1. Function Definition … Read more

Beginner’s Guide to Python: Mastering Conditional Statements and Loops with the ‘Guess the Number’ Game

Beginner's Guide to Python: Mastering Conditional Statements and Loops with the 'Guess the Number' Game

Introduction: Want to quickly get started with Python? Today, we’ll play the ‘Guess the Number’ game with just 20 lines of code, easily mastering the core syntax! The complete code and advanced tips are included at the end, making it easy for beginners to understand! 1. Why Choose ‘Guess the Number’ as a Learning Case? … Read more