Bài giảng Lập trình C# 2010: Chương 3 - ĐH Công nghệ Đồng Nai

Bài giảng Lập trình C# 2010: Chương 3 trình bày các nội dung về Data type, Operator, Variables, Statements, Exception (Kiểu dữ liệu, điều hành, biến, báo cáo, ngoại lệ) như khái niệm, cấu trúc, câu lệnh, thao tác thực hiện và một số nội dung khác. | 1 2 Format Code Format Code Description C or c Formats the string as currency. Precedes the number with an appropriate currency symbol ($ in the US). D or d Formats the string as a decimal. Displays number as an integer. N or n Formats the string with commas and two decimal places. 2 3 Format Code Format Code Description E or e Formats the number using scientific notation with a default of six decimal places F or f Formats the string with a fixed number of decimal places (two by default). G or g General. Either E or F. X or x Formats the string as hexadecimal. 3 4 Logical and Conditional Operators 5 Logical AND(&) Conditional AND (&&) Logical OR (|) Conditional OR (||) Logical NOT (!) Logical exclusive OR or XOR (^) 1 2 3 4 5 6 6 Used to add multiple conditions to a statement 7 exp1 exp2 exp1 && exp2 false false false false true false true false false true true true Truth table for the && (logical AND) operator. 8 Exp1 exp2 exp1 || exp2 false false false false true true true false true true true True Truth table for the || (logical OR) operator. 9 exp1 exp2 exp1 ^ exp2 false false false false true true true false true true true false Truth table for the logical exclusive OR (^) operator. expression !expression false true True false Truth table for operator! (logical NOT). 11 Control Structures Program of control Program performs one statement then goes to next line Sequential execution 12 Different statement other than the next one executes Selection structure The if and if/else statements Repetition structure The while and do/while loops The for and foreach loops 13 Flowcharting C#’s sequence structure. add grade to total add 1 to counter total = total + grade; counter = counter + 1; 14 if Selection Structure Causes the program to make a selection Chooses based on conditional Any expression that evaluates to a bool type True: perform an action False: skip the action Single entry/exit point Require no semicolon in syntax 15 if Selection Structure do something . | 1 2 Format Code Format Code Description C or c Formats the string as currency. Precedes the number with an appropriate currency symbol ($ in the US). D or d Formats the string as a decimal. Displays number as an integer. N or n Formats the string with commas and two decimal places. 2 3 Format Code Format Code Description E or e Formats the number using scientific notation with a default of six decimal places F or f Formats the string with a fixed number of decimal places (two by default). G or g General. Either E or F. X or x Formats the string as hexadecimal. 3 4 Logical and Conditional Operators 5 Logical AND(&) Conditional AND (&&) Logical OR (|) Conditional OR (||) Logical NOT (!) Logical exclusive OR or XOR (^) 1 2 3 4 5 6 6 Used to add multiple conditions to a statement 7 exp1 exp2 exp1 && exp2 false false false false true false true false false true true true Truth table for the && (logical AND) operator. 8 Exp1 exp2 exp1 || exp2 false false false false true true true false .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
103    134    5    27-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.