Announcement

Collapse
No announcement yet.

[Hè 2016] Buổi 2 - STL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Hè 2016] Buổi 2 - STL

    Chào các bạn,
    Lớp thuật toán hè buổi 2 tiếp tục diễn ra với nội dung như sau:

    - Thời gian: 9h00 - 12h00 thứ 3, ngày 12/7/2016
    - Địa điểm: Phòng A205
    - Nội dung: Giới thiệu về STL
    - Giảng viên hướng dẫn: ThS Nguyễn Văn Toàn
    - Đăng kí bằng cách reply tại đây với nội dung: Đăng kí tham gia

    Các bạn xem trước:
    [1] Tài liệu tham khảo: https://goo.gl/SDqbie
    [2] Slide trình bày:
    - .exe and .tar https://goo.gl/RY8QPY
    - .pdf: https://goo.gl/YjGYem

  • #2
    Đăng kí tham gia

    Comment


    • #3
      Đăng kí tham gia

      Comment


      • #4
        Đăng kí tham gia

        Comment


        • #5
          Đăng kí tham gia

          Comment


          • #6
            Đăng Kí Tham Gia

            Comment


            • #7
              Đăng kí tham... dự

              Comment


              • #8
                Slide về template.
                Xem thêm ở https://www.mediafire.com/#zlccs9ys147y6
                Attached Files
                Last edited by toannv; 12-07-2016, 10:33.

                Comment


                • #9
                  Code mẫu
                  PHP Code:

                  #include <iostream>
                  using namespace std;
                  template <class Type>
                  void SwapType &xType &y)
                  {
                      
                  Type t x;
                      
                  y;
                      
                  t;
                  }
                  template <class Typeint Size>
                  class 
                  MyArr
                  {
                      private:
                          
                  Type Arr[Size];
                      public:
                          
                  void KhoiGan()
                          {
                              
                  int i;
                              for (
                  i=0;i<Size;i++) Arr[i]=20-i;
                          }
                           
                  friend ostream &operator<<( ostream &output,
                                                         const 
                  MyArr &)
                          {
                              
                  int i;
                              for (
                  i=0;i<Size;i++) output<<A.Arr[i]<<" ";
                              
                  output<<endl;
                              return 
                  output;
                          }
                          
                  void Sort()
                          {
                              
                  int i,j;
                              for (
                  i=0;i<Size-1;i++)
                                  for (
                  j=i+1;j<Size;j++)
                                      if (
                  Arr[i]>Arr[j]) Swap(Arr[i],Arr[j]);
                          }
                  };

                  main()
                  {
                      
                  MyArr<int,10a;

                      
                  a.KhoiGan();
                      
                  cout<<a;
                      
                  a.Sort();
                      
                  cout<<a;
                  }

                  //Viet ham Sort dung duoc cho So Nguyen va So Thuc theo
                  //dang template 

                  Comment

                  LHQC

                  Collapse
                  Working...
                  X