By GokiSoft.com| 01:11 06/11/2021|
C Sharp

[Video] Tìm hiểu biến, toán tử, mệnh đề điều kiện, lặp (for, white, do .. while), switch - mảng trong C# - Khoá học lập trình C# - C2010G

Cài đặt môi trường:

https://dotnet.microsoft.com/download/dotnet-framework

https://visualstudio.microsoft.com/

Nội dung môn học:
	- Kiến thức core căn bản
		- Khai báo biến, toán tử, biểu thức điều kiện
		- mệnh đề điều kiện if else switch
		- vòng lặp for, while, do .. while
		- Lập trình OOP
			- Tích chất đóng gói
			- Tích chất kế thừa
			- Tích chất trừu tượng 
			- Tích chất đa hình
		- Interface
		- Event & delegate

		- Lập trình vs JSON
		- CSDL Console
==============================================================
Nôi dung học:
	- Khai báo biến, toán tử, biểu thức điều kiện
	- mệnh đề điều kiện if else switch
	- vòng lặp for, while, do .. while

C -> IDE (DevC/CodeLite/...) -> coding -> compile -> exe (binary) -> PC (running)
Java -> IDE(Netbean/Eclipse/...) -> coding -> compile -> jar (byte code) -> jvm -> exe (binary) -> PC (running)
C# -> IDE(Visual Studio) -> coding -> compile -> CIL -> .NET -> exe (binary) -> PC (running)
PC App -> C# .NET


.NET
	.NET Framework -> microsoft -> Window -> C# .NET window form
	.NET Core -> open source -> cross platform (Win, Linux, ...) -> Ứng dụng web (asp .net)

Coding Convention C#
	- Class + Method: Viet chu cai hoa dau tien



using System;

namespace Lesson01
{
    class Program
    {
        static void Main(string[] args)
        {
            //Test01();
            //Test02();
            //Test03();
            //Test04();
            Test05();
        }

        static void Test05()
        {
            //Tuong khai bao mang float, double, string, char -> thay int -> float, double, string, char
            //Khai bao 1 mang so nguyen gom 5 phan tu
            int[] t = new int[5];
            //length: 5 = t.Length, index: 0 -> length - 1 => 0 -> 4
            //Gan du lieu
            t[0] = 5;
            t[1] = 2;
            t[2] = 6;
            t[3] = 10;
            t[4] = 12;
            for(int i=0;i<t.Length;i++)
            {
                Console.WriteLine("t[{0}] = ", i);
                t[i] = int.Parse(Console.ReadLine());
            }

            int sum = 0;
            for(int i=0;i<t.Length;i++)
            {
                sum += t[i];
            }
            Console.WriteLine("sum = {0}", sum);
        }

        static void Test04()
        {
            int N = 6;
            for(int i=0;i<=N;i++)
            {
                for(int j=0;j<=i;j++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
        }

        static void Test03()
        {
            int value = 2;
            switch(value)
            {
                case 1:
                    Console.WriteLine("Hello 1");
                    break;
                case 2:
                    Console.WriteLine("Hello 2");
                    break;
                case 3:
                    Console.WriteLine("Hello 3");
                    break;
                default:
                    Console.WriteLine("Hello 4");
                    break;
            }
        }

        static void Test02()
        {
            int x = 2;
            int y = x++;//y = 2, x = 3
            int k = ++x;//x = 4, y = 2, k = 4
            int t = x++ + ++x - k-- - --y;
            //t = 4(x=5) + 6(x=6) - 4(k=3) - 1 (y=1) = 5
            Console.WriteLine("x = {0}, y = {1}, k = {2}, t = {3}", x, y, k, t);

            string s = (x == 6) ? "Xin chao" : "Goodbye";
            Console.WriteLine("s = {0}", s);
        }

        static void Test01()
        {
            Console.WriteLine("Hello World 01!");
            int x = 5, y = 10;
            int k;
            k = 10;
            float t = 12.5f;
            char c = 'A';
            Console.WriteLine("x = " + x + ", y = " + y + ", c = " + c);
            Console.WriteLine("x = {0} - {0} - {0}, y = {1}, c = {2}", x, y, c);
            string s = "Xin chao"; //Nen dung cach nay de khai bao string
            Console.WriteLine("s = {0}", s);
            String s1 = "Xin chao 123";
            Console.WriteLine("s1 = {0}", s1);

            //Nhap du lieu
            Console.WriteLine("Nhap k = ");
            k = int.Parse(Console.ReadLine());
            k = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Nhap s = ");
            s = Console.ReadLine();

            Console.WriteLine("s = {0}, k = {1}", s, k);
        }
    }


    class Program01
    {
        static void Main01(string[] args)
        {
            Console.WriteLine("Hello World 02!");
        }
    }


    class Program02
    {
        static void Main02(string[] args)
        {
            Console.WriteLine("Hello World 03!");
        }
    }
}

namespace Lesson01.Sub
{
    class Program
    {
        static void Main00(string[] args)
        {
            Console.WriteLine("Hello World 01!");
        }
    }


    class Program01
    {
        static void Main01(string[] args)
        {
            Console.WriteLine("Hello World 02!");
        }
    }


    class Program02
    {
        static void Main02(string[] args)
        {
            Console.WriteLine("Hello World 03!");
        }
    }
}







Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)

Đăng nhập để làm bài kiểm tra

Chưa có kết quả nào trước đó