Skip to content

Commit

Permalink
CS002 VariablesConstantsIO
Browse files Browse the repository at this point in the history
  • Loading branch information
XuanThuLab committed Aug 8, 2020
1 parent a4a4257 commit 207294d
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
27 changes: 27 additions & 0 deletions CS002_VariablesConstantsIO/.vscode/launch.json
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/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}"
}
]
}
42 changes: 42 additions & 0 deletions CS002_VariablesConstantsIO/.vscode/tasks.json
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}/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"
}
]
}
8 changes: 8 additions & 0 deletions CS002_VariablesConstantsIO/CS002_VariablesConstantsIO.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
74 changes: 74 additions & 0 deletions CS002_VariablesConstantsIO/Program.cs
Original file line number Diff line number Diff line change
@@ -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);


}




}
}

0 comments on commit 207294d

Please sign in to comment.