diff --git a/CS002_VariablesConstantsIO/.vscode/launch.json b/CS002_VariablesConstantsIO/.vscode/launch.json new file mode 100644 index 0000000..b3dcace --- /dev/null +++ b/CS002_VariablesConstantsIO/.vscode/launch.json @@ -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/CS002_VariablesConstantsIO.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}" + } + ] +} \ No newline at end of file diff --git a/CS002_VariablesConstantsIO/.vscode/tasks.json b/CS002_VariablesConstantsIO/.vscode/tasks.json new file mode 100644 index 0000000..2e7f6ff --- /dev/null +++ b/CS002_VariablesConstantsIO/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/CS002_VariablesConstantsIO.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/CS002_VariablesConstantsIO.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/CS002_VariablesConstantsIO.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/CS002_VariablesConstantsIO/CS002_VariablesConstantsIO.csproj b/CS002_VariablesConstantsIO/CS002_VariablesConstantsIO.csproj new file mode 100755 index 0000000..c73e0d1 --- /dev/null +++ b/CS002_VariablesConstantsIO/CS002_VariablesConstantsIO.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/CS002_VariablesConstantsIO/Program.cs b/CS002_VariablesConstantsIO/Program.cs new file mode 100755 index 0000000..3094039 --- /dev/null +++ b/CS002_VariablesConstantsIO/Program.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; + +namespace CS002_VariablesConstantsIO +{ + class Program + { + + static void Main(string[] args) + { + //Khai báo biến có tên studentName, lưu loại dữ liệu chuỗi + string studentName; + + // Khai báo biến và gán ngay giá trị lưu vào biến + string address = "Hà Nội, Việt Nam"; + + // Khai báo biến, sau đó trước khi sử dụng gán giá trị cho biến + int studentAge; + studentAge = 22; + + int seconds = 60; //khai báo biến số nguyên + double so_pi = 3.14; //khai báo biến số thực + bool deltaIsSezo = true; //Khai báo biến logic + char chooseAction = 'S' ; //Khai báo biến kiểu ký tự + string msgResult = "Kết quả giải:" ; // khai báo biến chuỗi + + Console.WriteLine(); //Xuống dòng + Console.WriteLine(); //Xuống dòng + + Console.ForegroundColor = ConsoleColor.DarkMagenta; //Đặt màu chữ + Console.WriteLine("XIN CHÀO - CHƯƠNG TRÌNH NHẬP XUẤT DỮ LIỆU"); //In dòng chữ + Console.ResetColor(); //Reset màu + + Console.Write("Giá trị biến so_pi là : "); //In dòng chữ + Console.WriteLine(so_pi); //In giá trị biến + Console.WriteLine(); //Xuống dòng + + int a = 123; + double b = 567.123; + + Console.WriteLine("Biến a = {0}, biến b = {1}", a, b); + + Console.WriteLine($"Biến a = {a}, biến b = {b} - tích là {a * b}"); + + + // NHẬP DỮ LIỆU + + string userLogin; + Console.Write("Nhập username : "); + userLogin = Console.ReadLine(); + Console.WriteLine($"Tên nhập vào là: {userLogin}"); + + Console.Write("Nhập một số thực : "); + // Nhập chuỗi - chuyển ngay chuỗi đó thành số thực + double dinput = Convert.ToDouble(Console.ReadLine()); + Console.WriteLine($"Số đã nhập là: {dinput}"); + + + var bien1 = 3.14; + var bien2 = 3; + var bien3 = "Biến khai báo với var phải khởi tạo ngay"; + var bien4 = (5 < 4); + + const string MON = "THỨ HAI"; + Console.WriteLine(MON); + + + } + + + + + } +}