-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
XuanThuLab
committed
Aug 8, 2020
1 parent
a4a4257
commit 91921b4
Showing
5 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": ".NET Core Launch (console)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/CS004_Logical_if_switch.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}", | ||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console | ||
"console": "internalConsole", | ||
"stopAtEntry": false | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach", | ||
"processId": "${command:pickProcess}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}/CS004_Logical_if_switch.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "publish", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"publish", | ||
"${workspaceFolder}/CS004_Logical_if_switch.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "watch", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"watch", | ||
"run", | ||
"${workspaceFolder}/CS004_Logical_if_switch.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<RootNamespace>CS004_Logical_if_switch</RootNamespace> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using System; | ||
|
||
namespace CS004_Logical_if_switch | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
// // VÍ DỤ SO SÁNH | ||
// int a = 5; | ||
// int b = 6; | ||
// // var c = (a == b); | ||
// var c = (a > b); | ||
// // var c = (a >= b); | ||
// // var c = (a < b); | ||
// // var c = (a <= b); | ||
// // var c = (a != b); | ||
|
||
|
||
// // VÍ DỤ LOGIC | ||
// bool a = false; | ||
// bool b = true; | ||
// bool c = a && b; | ||
// bool d = !a; | ||
// bool e = a || b; | ||
|
||
|
||
|
||
// //In ra mà hình nếu là số chẵn | ||
// int number = 1990; | ||
// if ((number % 2) == 0) | ||
// Console.WriteLine($"{number} là số chẵn"); | ||
|
||
|
||
// int a = 5; | ||
// int b = 10; | ||
// if (a >= b) | ||
// { | ||
// Console.WriteLine("Số a lớn hơn hoặc bằng số b"); | ||
// } | ||
// else | ||
// { | ||
// Console.WriteLine("Số a nhỏ hơn số b"); | ||
// } | ||
|
||
|
||
|
||
// int a = 10; | ||
// int b = 10; | ||
// if (a > b) | ||
// { | ||
// Console.WriteLine("Số a lớn hơn hoặc bằng số b"); | ||
// } | ||
// else if (a < b) | ||
// { | ||
// Console.WriteLine("Số a nhỏ hơn số b"); | ||
// } | ||
// else | ||
// { | ||
// Console.WriteLine("Hai số a, b bằng nhau"); | ||
// } | ||
|
||
// int age = 18; | ||
// var mgs = (age >= 18) ? "Đủ điều kiện" : "Không đủ điều kiện"; | ||
// Console.WriteLine(mgs); | ||
|
||
|
||
// var a = 2; | ||
// var b = 3.5; | ||
// var c = 2; | ||
// var max = a >= b ? a >= c ? a : c : b >=c ? b : c; | ||
// // Viết tường minh hơn | ||
// // max = (a >= b) ? (a >= c ? a : c) : (b >=c ? b : c); | ||
// Console.WriteLine(max); | ||
|
||
|
||
// int number = 2; | ||
// switch (number) | ||
// { | ||
// case 1: | ||
// Console.WriteLine("number có giá trị một"); | ||
// break; | ||
// case 2: | ||
// Console.WriteLine("number có giá trị hai"); | ||
// break; | ||
// default: | ||
// Console.WriteLine("number khác một và hai"); | ||
// break; | ||
// } | ||
|
||
int number = 2; | ||
if (number == 1) | ||
{ | ||
Console.WriteLine("number có giá trị một"); | ||
} | ||
else if (number == 2) | ||
{ | ||
Console.WriteLine("number có giá trị hai"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("number khác một và hai"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## Ví dụ về toán tử so sánh, logic và câu lệnh rẽ nhánh if, switch | ||
https://xuanthulab.net/toan-tu-so-sanh-logic-va-cac-cau-lenh-if-switch-trong-c-net.html |