User Tag List

+ Trả lời chủ đề
Trang 1/2 12 CuốiCuối
Hiện kết quả từ 1 tới 10 của 11

Chủ đề: JAVASCRIPT

  1. #1
    nguyenthanhtungtinbk
    Guest
    Đây là ngôn ngữ đã được xây dựng sẵn thành đối tượng, tương tự VBScript. Ngôn ngữ JS khá giống C nhưng rất tiện ích cho WEBSITE. Bác nào có source thì cùng post lên nhé. Nhưng cố gắng giải thích step by step để anh em cùng hiểu chứ down freesource thì trên mạng không thiếu.

  2. #2
    nguyenthanhtungtinbk
    Guest
    Kĩ thuật DIV là một trong những kĩ thuật cực phổ biến và hữu dụng trong JS.
    Những điều chính về DIV cần lưu ý là:
    :ph34r: obj.left hoặc obj.pixelLeft
    :ph34r: obj.top hoặc obj.pixelTop
    :ph34r: z-index của obj
    :ph34r: visibility của obj
    Trong đó obj là style của đối tượng DIV

    : Sóng dao động với DIV
    Mã nguồn có thể tải từ
    http://www11.brinkster.com/nguyenthanhtung...ce/JS/tWave.htm

  3. #3
    nguyenthanhtungtinbk
    Guest
    Nào giờ hãy tiếp tục cùng với DIV tạo một cái CLOCK cho riêng bạn. Kĩ thuật cần chú ý ở đây là khi dùng mảng:
    :ph34r: document.all[name của object].style

    :c: Tạo đồng hồ

    Nguyên lý : Phuong trình đường tròn
    x=Rcos(phi)
    y=Rsin(phi)

    Mã nguồn có thể tải từ
    http://www11.brinkster.com/nguyenthanhtung...e/JS/tClock.htm

    :ph34r: Có thể thấy rằng hàm window.setTimeout là hàm cực hữu dụng và được sử dụng rất nhiều trong JS

  4. #4
    dtvt4@k45.fet.hut.vn
    Guest

    Mặc định

    Em nói khí không phải mong bác chớ phật lòng. Diễn đàn chứ có phải là cái lớp học hay buổi tập huấn đâu mà bác post mấy cái này cho tốn chỗ.

    Bác học JS, chỗ nào mắc thì lên đây hỏi để mọi người cùng bàn luận và đưa ra solution.

  5. #5
    nguyenthanhtungtinbk
    Guest
    Thẻ <TABLE> là một thẻ bất cứ ai học HTML cũng đều biết, có mặt trong hầu hết mọi trang web. Tui có nghĩ ra một mẹo nhỏ sử dụng cái này vẽ biểu đồ. Điểm đáng nói là biểu đồ này được vẽ sau khi chạy C++, dùng vòng lặp, không phải bằng cách ngồi gõ từng dòng. Đây chỉ là một mẹo rất rất nhỏ, mong các bác cho lời góp ý. Nếu quả thực không hữu dụng lần sau tui không post nữa.

    :c: Nguyên lý
    Mã:
    &#60;script language=&#34;javascript&#34;&#62;
    //Written by Nguyen Thanh Tung
    function DrawLine&#40;lTOP, lLEFT, lHEIGHT, lWIDTH, lCOLOR&#41;
    {
     &nbsp; document.writeln&#40;&#34;&#60;DIV style=&#092;&#34;POSITION&#58; absolute; TOP&#58;&#34;+lTOP+&#34;;LEFT&#58;&#34;+lLEFT+&#34;;&#092;&#34;&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;TABLE style=&#092;&#34;BACKGROUND-COLOR&#58;&#34;+lCOLOR+&#34;; WIDTH&#58;&#34;+lWIDTH+&#34;; HEIGHT&#58;&#34;+lHEIGHT+&#34;;&#092;&#34;&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;TBODY&#62;&#60;TR&#62;&#34;&#41;; &nbsp; 
     &nbsp; document.writeln&#40;&#34;&#60;TH&#62;&#60;/TH&#62;&#34;&#41;; &nbsp; 
     &nbsp; document.writeln&#40;&#34;&#60;/TR&#62;&#60;/TBODY&#62;&#60;/TABLE&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;/DIV&#62;&#34;&#41;;
    }
    function DrawHLineDut&#40;lTOP, lLEFT, lSIZE, lWIDTH, lCOLOR&#41;
    {
     &nbsp; document.writeln&#40;&#34;&#60;DIV style=&#092;&#34;POSITION&#58; absolute; TOP&#58;&#34;+lTOP+&#34;;LEFT&#58;&#34;+lLEFT+&#34;;&#092;&#34;&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;TABLE style=&#092;&#34;FONT-WEIGHT&#58; BOLD; FONT-SIZE&#58; &#34;+lSIZE+&#34;ex; COLOR&#58;&#34;+lCOLOR+&#34;; WIDTH&#58;&#34;+lWIDTH+&#34;;&#092;&#34;&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;TBODY&#62;&#60;TR&#62;&#34;&#41;;
     &nbsp; for &#40;i=1; i&#60;&#40;lWIDTH/20&#41;;i++&#41; document.writeln&#40;&#34;&#60;TH&#62;-&#60;/TH&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;/TR&#62;&#60;/TBODY&#62;&#60;/TABLE&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;/DIV&#62;&#34;&#41;;
    }
    function DrawVLineDut&#40;lTOP, lLEFT, lSIZE, lLENGTH, lCOLOR&#41;
    {
     &nbsp; document.writeln&#40;&#34;&#60;DIV style=&#092;&#34;POSITION&#58; absolute; TOP&#58;&#34;+lTOP+35+&#34;;LEFT&#58;&#34;+lLEFT+&#34;;&#092;&#34;&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;TABLE style=&#092;&#34;FONT-WEIGHT&#58; BOLD; FONT-SIZE&#58; &#34;+lSIZE+&#34;ex; COLOR&#58;&#34;+lCOLOR+&#34;&#092;&#34;&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;TBODY&#62;&#34;&#41;;
     &nbsp; for &#40;i=1; i&#60;&#40;lLENGTH/20&#41;;i++&#41; document.writeln&#40;&#34;&#60;TR&#62;&#60;TH&#62;|&#60;/TH&#62;&#60;/TR&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;/TBODY&#62;&#60;/TABLE&#62;&#34;&#41;;
     &nbsp; document.writeln&#40;&#34;&#60;/DIV&#62;&#34;&#41;;
    }
    &#60;/SCRIPT&#62;
    :c: Các file header của C++
    :c: Sort.h
    Mã:
    #ifndef SORT_h
    #define SORT_h
    
    ///////////////////////////Include
    //#include	&#60;iostream&#62;
    //#include	&#60;iomanip&#62;
    #include	&#60;ctime&#62;
    
    //using	namespace	std;
    
    const	int	ArraySize = 1001;
    /*******************************************************************
     /////////////////////////CLASS/////////////////////////////////////
     *******************************************************************/
    /*
     * &nbsp;VIRTUAL CLASS
     */
    class	GeneralSort // Ascending number 
    {
    	protected	&#58;	
     &nbsp;int &nbsp;Size;
     &nbsp;int &nbsp;*Array;
    	public	&#58;
     &nbsp;virtual	void	Sort&#40;int S, int *A&#41;
     &nbsp;{
     &nbsp;	Size = S;
     &nbsp;	Array = A;
     &nbsp;};	
     &nbsp;void	Swap&#40;int &x, int &y&#41;
     &nbsp;{
     &nbsp;	int	temp = x;
     &nbsp;	x = y; 
     &nbsp;	y = temp;
     &nbsp;};
     &nbsp;void	Output&#40;&#41;
     &nbsp;{
     &nbsp;	//cout &#60;&#60; &#34;&#092;nSequence number after sorting &#58; &#092;n&#34;;
    
     &nbsp; &nbsp; &nbsp; &nbsp; for	&#40;int i = 1; i &#60;= Size; i++&#41;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cout &#60;&#60;	setw&#40;6&#41; &#60;&#60; Array&#91;i&#93;; 
     &nbsp;	cout&#60;&#60;endl;
     &nbsp;}
    };
    /*
     * &nbsp;SELECTSORT CLASS
     */
    class	SelectSort &#58; public	GeneralSort
    {
    	public	&#58;
     &nbsp;virtual	void	Sort&#40;int Size, int *Array&#41;;
    };
    /*
     * &nbsp;QUICKSORT CLASS
     */
    class	QuickSort &#58; public	GeneralSort
    {
    	public	&#58;
     &nbsp;virtual	void	Sort&#40;int Size, int *Array&#41;; &nbsp;
     &nbsp;void	Process&#40;int left, int right&#41;;
    };
    
    /*******************************************************************
     /////////////////////////CLASS FUNCTION////////////////////////////
     *******************************************************************/
    /*
     * &nbsp;SELECTSORT CLASS
     */
    void	SelectSort&#58;&#58;Sort&#40;int Size, int *Array&#41;
    {
    	GeneralSort&#58;&#58;Sort&#40;Size, Array&#41;;
    	double	Start = time&#40;0&#41;;
    
    	for	&#40;int i = 1; i &#60; Size; i++&#41;
     &nbsp;for	&#40;int j = i + 1; j &#60;= Size; j++&#41;
     &nbsp;	if	&#40;Array&#91;i&#93; &#62; Array&#91;j&#93;&#41;	Swap&#40;Array&#91;i&#93;, Array&#91;j&#93;&#41;;
    
    	double	Finish = time&#40;0&#41;;
    	//cout &#60;&#60; &#34;The time took our for SelectSort about &#58; &#34; &#60;&#60; &#40;Finish - Start&#41; &#60;&#60; &#34; seconds&#34; &#60;&#60; endl;
    }
    /*
     * &nbsp;QUICKSORT CLASS
     */
    void	QuickSort&#58;&#58;Sort&#40;int Size, int *Array&#41;
    {
    	GeneralSort&#58;&#58;Sort&#40;Size, Array&#41;;
    	int	Start = time&#40;0&#41;;
    	Process&#40;1, Size&#41;;
    	int	Finish = time&#40;0&#41;;
    	//cout &#60;&#60; &#34;The time took our for QuickSort about &#58; &#34; &#60;&#60; &#40;Finish - Start&#41; &#60;&#60; &#34; Seconds&#34; &#60;&#60; endl;
    }
    void	QuickSort&#58;&#58;Process&#40;int left, int right&#41;
    {
    	int	Middle = Array&#91;&#40;left + right&#41; / 2&#93;;
    	int	i = left, j = right;
    
    	cout&#60;&#60;endl&#60;&#60;&#34;========BEGIN=======&#34;&#60;&#60;endl;
    	Output&#40;&#41;;
    	cout&#60;&#60;&#34;Middle=&#91;&#34;&#60;&#60;&#40;left + right&#41; / 2&#60;&#60;&#34;&#93;=&#34;&#60;&#60;Array&#91;&#40;left + right&#41; / 2&#93;&#60;&#60;endl;
    	do
    	{
     &nbsp;while	&#40;Array&#91;i&#93; &#60; Middle&#41;	i++;
     &nbsp;while	&#40;Array&#91;j&#93; &#62; Middle&#41;	j--;
     &nbsp;if	&#40;i &#60;= j&#41;	
     &nbsp;{
     &nbsp;	cout&#60;&#60;&#34;i=&#34;&#60;&#60;i&#60;&#60;&#34; j=&#34;&#60;&#60;j;
     &nbsp;	cout&#60;&#60;&#34; &nbsp;&#91;i&#93;=&#34;&#60;&#60;Array&#91;i&#93;&#60;&#60;&#34; &#91;j&#93;=&#34;&#60;&#60;Array&#91;j&#93;&#60;&#60;endl;
     &nbsp;	Swap&#40;Array&#91;i++&#93;, Array&#91;j--&#93;&#41;;
     &nbsp;}
    	}
    	while	&#40;i &#60;= j&#41;;	
    
    	if	&#40;left &#60; j&#41;
    	{
     &nbsp;cout&#60;&#60;endl;
     &nbsp;cout&#60;&#60;&#34;left=&#34;&#60;&#60;left&#60;&#60;&#34; j=&#34;&#60;&#60;j&#60;&#60;endl;
     &nbsp;Process&#40;left, j&#41;;
    	}
    	if	&#40;i &#60; right&#41; 
    	{
     &nbsp;cout&#60;&#60;endl;
     &nbsp;cout&#60;&#60;&#34;i=&#34;&#60;&#60;i&#60;&#60;&#34; right=&#34;&#60;&#60;right&#60;&#60;endl; &nbsp;
     &nbsp;Process&#40;i, right&#41;;
    	}
    	cout&#60;&#60;endl&#60;&#60;&#34;========END=======&#34;&#60;&#60;endl;
    }
    
    #endif
    :c: Matrix.h
    Mã:
    #ifndef Matrix_H
    #define Matrix_H
    
    /////////////////////////INCLUDE
    #include &#60;iostream&#62;
    using std&#58;&#58;cout;
    using std&#58;&#58;cin;
    using std&#58;&#58;endl;
    using std&#58;&#58;istream;
    using std&#58;&#58;ostream;
    #include &#60;fstream&#62;
    using std&#58;&#58;fstream;
    using std&#58;&#58;ios;
    #include &#60;iomanip&#62;
    using std&#58;&#58;setw;
    using std&#58;&#58;setprecision;
    using std&#58;&#58;fixed;
    using std&#58;&#58;setfill;
    #include &#60;cmath&#62;
    
    #include &#60;cstring&#62;
    #include &#60;new&#62;
    
    template &#60;class Te&#62;
    Te max&#40;Te a, Te b&#41;
    {
    	if &#40;a&#62;=b&#41; return a;
    	else &nbsp; &nbsp; &nbsp;return b; 
    }
    template &#60;class Te&#62;
    Te min&#40;Te a, Te b&#41;
    {
    	if &#40;a&#60;=b&#41; return a;
    	else &nbsp; &nbsp; &nbsp;return b; 
    }
    
    const int KTMax = 7;
    const int MucLamTron = 2;
    /*******************************************************************
     ///////////////////////////////////CLASS///////////////////////////
     *******************************************************************/
    class Matrix
    {
    private&#58;
    	double PT&#91;KTMax&#93;&#91;KTMax&#93;;
    	unsigned NumRow, NumCol;
    public&#58;
    	Matrix&#40;&#41; { NumRow=0; NumCol=0; };
    	Matrix&#40;const unsigned r, const unsigned c&#41;;
    	Matrix&#40;const unsigned r, const unsigned c, const char *Kind&#41;;
    	Matrix&#40;double M&#91;&#93;&#91;KTMax&#93;, const unsigned numr, const unsigned numc&#41;;
    	Matrix&#40;const Matrix&&#41;;
    	~Matrix&#40;&#41; { };
    
    	friend	ostream& operator &#60;&#60; &#40;ostream &,const Matrix &&#41;;
    	friend	istream& operator &#62;&#62; &#40;istream &, Matrix & &#41;;
    	friend	fstream& operator &#60;&#60; &#40;fstream &,const Matrix & &#41;;
    	friend	fstream& operator &#62;&#62; &#40;fstream &, Matrix & &#41;;
    
    	void setValue&#40;unsigned short offset1, unsigned short offset2, double Value&#41;
    	{
     &nbsp;PT&#91;offset1&#93;&#91;offset2&#93; = Value;
    	}
    	double getValue&#40;unsigned short offset1, unsigned short offset2&#41;
    	{
     &nbsp;return PT&#91;offset1&#93;&#91;offset2&#93;;
    	}
    	double getTotal&#40;&#41;
    	{
     &nbsp;double Total=0;
     &nbsp;for &#40;unsigned r=0; r&#60;NumRow; r++&#41;
     &nbsp;	for &#40;unsigned c=0; c&#60;NumCol; c++&#41;
     &nbsp;	{
     &nbsp; &nbsp;Total += PT&#91;r&#93;&#91;c&#93;;
     &nbsp;	}
    
     &nbsp;return Total;
    	}
    
    	friend Matrix &nbsp; operator &nbsp;- &nbsp;&#40;const Matrix&&#41;;
    	friend Matrix &nbsp; GJ &#40;double M&#91;KTMax&#93;&#91;KTMax&#93;, unsigned NumRow, unsigned NumCol, int Kind&#41;;
    	Matrix &nbsp; Inverse &nbsp; &nbsp;&#40;const Matrix&&#41;;
    	Matrix &nbsp; GaussJord &nbsp;&#40;const Matrix&&#41;;
    
    	friend Matrix	operator &nbsp;+ &nbsp;&#40;const Matrix& , const Matrix &&#41;;
     &nbsp; &nbsp;friend Matrix	operator &nbsp;- &nbsp;&#40;const Matrix& , const Matrix &&#41;;
    	friend Matrix	operator &nbsp;* &nbsp;&#40;const Matrix& , const Matrix &&#41;;
    	friend Matrix	operator &nbsp;/ &nbsp;&#40;const Matrix& , const Matrix &&#41;; &nbsp; 
    
    	double determinant&#40;&#41;;
    	friend double DinhThuc&#40;double A&#91;KTMax&#93;&#91;KTMax&#93;,const int n&#41;;
    };
    /*******************************************************************
     ///////////////////////////////////CLASS FUNCTION//////////////////
     *******************************************************************/
    /******************************
     * &nbsp;Constructor & destructor
     ******************************/
    Matrix&#58;&#58;Matrix&#40;const unsigned r, const unsigned c&#41;
    {
    	NumRow=r; 
    	NumCol=c; 
    }
    Matrix&#58;&#58;Matrix&#40;const unsigned r, const unsigned c, const char *Kind&#41;
    {
    	NumRow=r; 
    	NumCol=c;
    
    	if &#40;strcmp&#40;Kind, &#34;O&#34;&#41; == 0&#41;
    	{
     &nbsp; &nbsp;for &#40;unsigned r=0; r&#60;NumRow; r++&#41;
     &nbsp;for &#40;unsigned c=0; c&#60;NumCol; c++&#41;
     &nbsp;{
     &nbsp;	PT&#91;r&#93;&#91;c&#93; = 0;
     &nbsp;}
    	}
    	if &#40;strcmp&#40;Kind, &#34;I&#34;&#41; == 0&#41;
    	{
     &nbsp; &nbsp;for &#40;unsigned r=0; r&#60;NumRow; r++&#41;
     &nbsp;for &#40;unsigned c=0; c&#60;NumCol; c++&#41;
     &nbsp;{
     &nbsp;	PT&#91;r&#93;&#91;c&#93; = 0;
     &nbsp;	if &#40;r==c&#41; &nbsp;PT&#91;r&#93;&#91;c&#93; = 1;
     &nbsp;}
    	}
    }
    Matrix&#58;&#58;Matrix&#40;double M&#91;&#93;&#91;KTMax&#93;, const unsigned numr, const unsigned numc&#41;
    {
    	NumRow = numr;
    	NumCol = numc;
    
    	for &#40;unsigned r=0; r&#60;NumRow; r++&#41;
     &nbsp;for &#40;unsigned c=0; c&#60;NumCol; c++&#41;
     &nbsp;{
     &nbsp;	PT&#91;r&#93;&#91;c&#93; = M&#91;r&#93;&#91;c&#93;;
     &nbsp;}
    
    }
    Matrix&#58;&#58;Matrix&#40;const Matrix& M&#41;
    {
    	NumRow = M.NumRow;
    	NumCol = M.NumCol;
    
    	for &#40;unsigned r=0; r&#60;NumRow; r++&#41;
     &nbsp;for &#40;unsigned c=0; c&#60;NumCol; c++&#41;
     &nbsp;{
     &nbsp;	PT&#91;r&#93;&#91;c&#93; = M.PT&#91;r&#93;&#91;c&#93;;
     &nbsp;}
    }
    /**************
     * &nbsp;Xuat nhap
     **************/
    ostream& operator &#60;&#60; &#40;ostream& os,const Matrix & M&#41;
    {
    	os&#60;&#60;std&#58;&#58;setiosflags&#40;ios&#58;&#58;showpoint&#41;&#60;&#60;std&#58;&#58;fixed&#60;&#60;std&#58;&#58;setprecision&#40;MucLamTron&#41;;
    	for &#40;int i=0; i&#60;M.NumRow; i++&#41;
    	{
     &nbsp;for &#40;int j=0; j&#60;M.NumCol; j++&#41;
     &nbsp;{
     &nbsp;	os&#60;&#60;setw&#40;MucLamTron+3 + 6&#41;&#60;&#60;M.PT&#91;i&#93;&#91;j&#93;;
     &nbsp;} &nbsp;
     &nbsp; &nbsp; os&#60;&#60;endl;
    	}
    
    	return os;
    }
    istream& operator &#62;&#62;&#40;istream& is,Matrix & M&#41;
    {
    	cout&#60;&#60;&#34;Number of rows = &#34;;
    	is&#62;&#62;M.NumRow;
    	cout&#60;&#60;&#34;Number of columns = &#34;;
    	is&#62;&#62;M.NumCol;
    
    	for &#40;unsigned i=0; i&#60;M.NumRow; i++&#41;
    	{
     &nbsp;cout&#60;&#60;&#34;Nhap hang &#34;&#60;&#60;i+1&#60;&#60;&#34; &#58; &#34;;
     &nbsp;for &#40;unsigned j=0; j&#60;M.NumCol; j++&#41;
     &nbsp;{
     &nbsp;	is&#62;&#62;M.PT&#91;i&#93;&#91;j&#93;;
     &nbsp;}
    	}
    
    	return is;
    }
    fstream& operator &#60;&#60; &#40;fstream& fs,const Matrix & M&#41;
    {	
    	//fs&#60;&#60;M.NumRow;
    	//fs&#60;&#60;M.NumCol;
    
    	fs&#60;&#60;std&#58;&#58;fixed&#60;&#60;std&#58;&#58;setprecision&#40;MucLamTron&#41;;
    	for &#40;int i=0; i&#60;M.NumRow; i++&#41;
    	{
     &nbsp;for &#40;int j=0; j&#60;M.NumCol; j++&#41;
     &nbsp;{
     &nbsp;	fs&#60;&#60;setw&#40;MucLamTron+3 + 6&#41;&#60;&#60;M.PT&#91;i&#93;&#91;j&#93;;
     &nbsp;} &nbsp;
     &nbsp; &nbsp; fs&#60;&#60;endl;
    	}
    
    	return fs;
    }
    fstream& operator &#62;&#62;&#40;fstream& fs,Matrix & M&#41;
    {	
    	//fs&#62;&#62;M.NumRow;
    	//fs&#62;&#62;M.NumCol;
    
    	for &#40;unsigned i=0; i&#60;M.NumRow; i++&#41;
    	{ &nbsp;
     &nbsp;for &#40;unsigned j=0; j&#60;M.NumCol; j++&#41;
     &nbsp;{
     &nbsp;	fs&#62;&#62;M.PT&#91;i&#93;&#91;j&#93;; &nbsp;	
     &nbsp;}
    	}
    
    	return fs;
    }
    /**************
     * &nbsp;Tinh toan
     **************/
     /*
     &nbsp;* So doi
     &nbsp;*/
    Matrix	operator - &#40;const Matrix& M&#41;
    {
    	Matrix kq;
    
    	for &#40;unsigned r=0; r&#60;M.NumRow; r++&#41;
     &nbsp;for &#40;unsigned c=0; c&#60;M.NumCol; c++&#41;
     &nbsp;{
     &nbsp;	kq.PT&#91;r&#93;&#91;c&#93; = &#40;-1&#41;*M.PT&#91;r&#93;&#91;c&#93;;
     &nbsp;}
    	kq.NumRow = M.NumRow;
    	kq.NumCol = M.NumCol;
    
    	return kq;
    }
     /*
     &nbsp;* Inverse & GaussJord
     &nbsp;*
    Matrix GJ&#40;double M&#91;KTMax&#93;&#91;KTMax&#93;, unsigned NumRow, unsigned NumCol, int Kind&#41;
    {	
     &nbsp; &nbsp;Matrix A&#40;M, NumRow, NumCol&#41;, I&#40;NumRow, NumCol, &#34;I&#34;&#41;;
    
    	unsigned r,c,k, row;
    	unsigned n=min&#40;r, c&#41;;
    	double tg;
    	
    	for &#40;k=0; k&#60;n; k++&#41;
    	{
     &nbsp;//Xem xet ma tran lieu co suy bien khong
     &nbsp;row = k;
     &nbsp;for &#40;r=k+1; r&#60;n; r++&#41;
     &nbsp;	if &#40; abs&#40;A.PT&#91;r&#93;&#91;k&#93;&#41; &#62; abs&#40;A.PT&#91;row&#93;&#91;k&#93;&#41; &#41; &nbsp;row=r;
     &nbsp;if &#40; abs&#40;A.PT&#91;r&#93;&#91;k&#93;&#41; &#60; 1.0E-8&#41;
     &nbsp;{
     &nbsp;	//Ma tran suy bien khong ton tai ma tran nghich dao
     &nbsp;	return A;
     &nbsp;}
    
     &nbsp;//Hoan vi hang row va hang k
     &nbsp;for &#40;c=0; c&#60;n; c++&#41;
     &nbsp;{
     &nbsp;	tg = A.PT&#91;k&#93;&#91;c&#93;;
     &nbsp;	A.PT&#91;k&#93;&#91;c&#93; = A.PT&#91;row&#93;&#91;c&#93;;
     &nbsp;	A.PT&#91;row&#93;&#91;c&#93; = tg;
    
     &nbsp;	tg = I.PT&#91;k&#93;&#91;c&#93;;
     &nbsp;	I.PT&#91;k&#93;&#91;c&#93; = I.PT&#91;row&#93;&#91;c&#93;;
     &nbsp;	I.PT&#91;row&#93;&#91;c&#93; = tg;
     &nbsp;}
    
     &nbsp;//Chia hang k cho &#91;k,k&#93; =&#62; &#91;k,k&#93;=1
     &nbsp;tg = A.PT&#91;k&#93;&#91;k&#93;;
     &nbsp;for &#40;c=0; c&#60;n; c++&#41;
     &nbsp;{
     &nbsp;	A.PT&#91;k&#93;&#91;c&#93; /= tg;
     &nbsp;	I.PT&#91;k&#93;&#91;c&#93; /= tg;
     &nbsp;}
    
     &nbsp;//Khu cot k lam cho moi phan tu &#91;r,k&#93; = 0 voi r &#33;= k
     &nbsp;for &#40;r=0; r&#60;n; r++&#41;
     &nbsp;{
     &nbsp;	if &#40;r &#33;= k&#41;
     &nbsp;	{
     &nbsp; &nbsp;for &#40;c=0; c&#60;n; c++&#41;
     &nbsp; &nbsp;{
     &nbsp; &nbsp;	A.PT&#91;r&#93;&#91;c&#93; -= A.PT&#91;r&#93;&#91;k&#93;*A.PT&#91;k&#93;&#91;c&#93;;
     &nbsp; &nbsp;	I.PT&#91;r&#93;&#91;c&#93; -= I.PT&#91;r&#93;&#91;k&#93;*I.PT&#91;k&#93;&#91;c&#93;;
     &nbsp; &nbsp;}
     &nbsp;	}
     &nbsp;}
    
    	if &#40;Kind==1&#41; &nbsp;return A; &nbsp;// Chi GuassJord
    	return I; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Tinh nghich dao
    }
    Matrix &nbsp;Matrix&#58;&#58;GaussJord &#40;const Matrix& M&#41;
    {	
    	return GJ&#40;M.PT, M.NumRow, M.NumCol, 1&#41;;
    }
    Matrix &nbsp;Matrix&#58;&#58;Inverse &#40;const Matrix& M&#41;
    {
    	return GJ&#40;M.PT, M.NumRow, M.NumCol, 0&#41;;
    }*/
    /*
    Matrix &nbsp;Inverse &#40;const Matrix& M&#41;
    {	
    	if &#40;M.NumRow &#33;= M.NumCol&#41; return Matrix&#40;&#41;;
    
     &nbsp; &nbsp;Matrix A&#40;M&#41;, I&#40;M.NumRow, M.NumCol, &#34;I&#34;&#41;;
    
    	unsigned r,c,k, row;
    	unsigned n=min&#40;M.NumRow, M.NumCol&#41;;
    	double tg;
    	
    	for &#40;k=0; k&#60;n; k++&#41;
    	{
     &nbsp;//Xem xet ma tran lieu co suy bien khong
     &nbsp;row = k;
     &nbsp;for &#40;r=k+1; r&#60;n; r++&#41;
     &nbsp;	if &#40; abs&#40;A.PT&#91;r&#93;&#91;k&#93;&#41; &#62; abs&#40;A.PT&#91;row&#93;&#91;k&#93;&#41; &#41; &nbsp;row=r;
     &nbsp;if &#40; abs&#40;A.PT&#91;r&#93;&#91;k&#93;&#41; &#60; 1.0E-8&#41;
     &nbsp;{
     &nbsp;	//Ma tran suy bien khong co nghich dao
     &nbsp;	return A;
     &nbsp;}
    
     &nbsp;//Hoan vi hang row va hang k
     &nbsp;for &#40;c=0; c&#60;n; c++&#41;
     &nbsp;{
     &nbsp;	tg = A.PT&#91;k&#93;&#91;c&#93;;
     &nbsp;	A.PT&#91;k&#93;&#91;c&#93; = A.PT&#91;row&#93;&#91;c&#93;;
     &nbsp;	A.PT&#91;row&#93;&#91;c&#93; = tg;
    
     &nbsp;	tg = I.PT&#91;k&#93;&#91;c&#93;;
     &nbsp;	I.PT&#91;k&#93;&#91;c&#93; = I.PT&#91;row&#93;&#91;c&#93;;
     &nbsp;	I.PT&#91;row&#93;&#91;c&#93; = tg;
     &nbsp;}
    
     &nbsp;//Chia hang k cho &#91;k,k&#93; =&#62; &#91;k,k&#93;=1
     &nbsp;tg = A.PT&#91;k&#93;&#91;k&#93;;
     &nbsp;for &#40;c=0; c&#60;n; c++&#41;
     &nbsp;{
     &nbsp;	A.PT&#91;k&#93;&#91;c&#93; /= tg;
     &nbsp;	I.PT&#91;k&#93;&#91;c&#93; /= tg;
     &nbsp;}
    
     &nbsp;//Khu cot k lam cho moi phan tu &#91;r,k&#93; = 0 voi r &#33;= k
     &nbsp;for &#40;r=0; r&#60;n; r++&#41;
     &nbsp;{
     &nbsp;	if &#40;r &#33;= k&#41;
     &nbsp;	{
     &nbsp; &nbsp;for &#40;c=0; c&#60;n; c++&#41;
     &nbsp; &nbsp;{
     &nbsp; &nbsp;	A.PT&#91;r&#93;&#91;c&#93; -= A.PT&#91;r&#93;&#91;k&#93;*A.PT&#91;k&#93;&#91;c&#93;;
     &nbsp; &nbsp;	I.PT&#91;r&#93;&#91;c&#93; -= I.PT&#91;r&#93;&#91;k&#93;*I.PT&#91;k&#93;&#91;c&#93;;
     &nbsp; &nbsp;}
     &nbsp;	}
     &nbsp;}
    
    	return I;
    }
    */
     /*
     &nbsp;* Phep cong tru nhan chia
     &nbsp;*/
    Matrix	operator + &#40;const Matrix& M1, const Matrix& M2&#41;
    {
    	Matrix kq;
    	kq.NumRow = max&#40;M1.NumRow, M2.NumRow&#41;;
    	kq.NumCol = max&#40;M1.NumCol, M2.NumCol&#41;;
    	
    	for &#40;unsigned i=0; i&#60;kq.NumRow; i++&#41;
     &nbsp; &nbsp; &nbsp;for &#40;unsigned j=0; j&#60;kq.NumCol; j++&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kq.PT&#91;i&#93;&#91;j&#93; = 0;
     &nbsp; &nbsp; if &#40;i&#60;M1.NumRow && j&#60;M1.NumCol&#41; kq.PT&#91;i&#93;&#91;j&#93; += M1.PT&#91;i&#93;&#91;j&#93;;
     &nbsp; &nbsp; if &#40;i&#60;M2.NumRow && j&#60;M2.NumCol&#41; kq.PT&#91;i&#93;&#91;j&#93; += M2.PT&#91;i&#93;&#91;j&#93;;
     &nbsp; }
     &nbsp; &nbsp; &nbsp; &nbsp;
    	return kq;
    }
    
    Matrix	operator - &#40;const Matrix& M1,const Matrix& M2&#41;
    {
    	return &#40;-M2 + M1&#41;;
    }
    
    Matrix	operator * &#40;const Matrix& M1,const Matrix& M2&#41;
    {
    	Matrix kq;
    
    	if &#40;M1.NumCol &#33;= M2.NumRow&#41;
    	{ &nbsp;
     &nbsp;kq.NumRow = 0;
     &nbsp;kq.NumCol = 0; &nbsp;
     &nbsp;return kq;
    	} &nbsp;
    	
    	kq.NumRow = M1.NumRow;
    	kq.NumCol = M2.NumCol;
     &nbsp; 
    	for &#40;unsigned i=0; i&#60;M1.NumRow; i++&#41;
     &nbsp; &nbsp; &nbsp;for &#40;unsigned j=0; j&#60;M2.NumCol; j++&#41;
     &nbsp; {
     &nbsp; &nbsp; &nbsp; &nbsp; kq.PT&#91;i&#93;&#91;j&#93;=0;
     &nbsp; &nbsp; &nbsp;for &#40;unsigned k=0; k&#60;M2.NumRow; k++&#41;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kq.PT&#91;i&#93;&#91;j&#93; += M1.PT&#91;i&#93;&#91;k&#93; * M2.PT&#91;k&#93;&#91;j&#93;;
     &nbsp; }
    
     &nbsp; &nbsp;return kq;
    }
     /*
     &nbsp;* Tinh dinh thuc
     &nbsp;*/
    double DinhThuc&#40;double A&#91;KTMax&#93;&#91;KTMax&#93;,const int n&#41;
    {
    	double KQ=0;
    	double A1&#91;KTMax&#93;&#91;KTMax&#93;;
    
    	if &#40;n&#60;1&#41; &nbsp;return 0;
    	if &#40;n==1&#41; return A&#91;0&#93;&#91;0&#93;;
    	if &#40;n==2&#41; return A&#91;0&#93;&#91;0&#93;*A&#91;1&#93;&#91;1&#93; - A&#91;0&#93;&#91;1&#93;*A&#91;1&#93;&#91;0&#93;;
    
    	for &#40;int c=0; c&#60;n; c++&#41; 
    	{
     &nbsp;
     &nbsp;for &#40;int i=0; i&#60;n-1; i++&#41;
     &nbsp;	for &#40;int j=0; j&#60;n-1; j++&#41;
     &nbsp;	{
     &nbsp; &nbsp;if &#40;j&#60;c&#41; A1&#91;i&#93;&#91;j&#93; = A&#91;i+1&#93;&#91;j&#93;;
     &nbsp; &nbsp;else &nbsp; &nbsp; A1&#91;i&#93;&#91;j&#93; = A&#91;i+1&#93;&#91;j+1&#93;;
     &nbsp;	}
    
     &nbsp;KQ += pow&#40;-1,c&#41;*A&#91;0&#93;&#91;c&#93; * DinhThuc&#40;A1, n-1&#41;;
    	}
    
    	return KQ;
    }
    double Matrix&#58;&#58;determinant&#40;&#41;
    {
    	if &#40;NumRow &#33;= NumCol&#41; 
    	{
     &nbsp;cout&#60;&#60;&#34;Can not find the determinant of the matrix&#092;n&#34;;
     &nbsp;return 0;
    	}
    	return DinhThuc&#40;PT, NumRow&#41;;
    }
    
    #endif
    :c: File chính Population.cpp
    Mã:
    #include &#60;conio.h&#62;
    #include &#60;stdio.h&#62;
    #include &#34;Matrix.h&#34;
    #include &#34;Sort.h&#34;
    
    Matrix DanSo2&#40;const Matrix& X, const Matrix& A, unsigned year&#41;
    {
    	Matrix R&#40;X&#41;;	
    	for &#40;unsigned i=1; i&#60;=&#40;year-1990&#41;/10; i++&#41;
    	{
     &nbsp;R=A*R;
    	}
    	return R;
    }
    Matrix DanSo4&#40;const Matrix& X, const Matrix& A, unsigned year&#41;
    {
    	Matrix R&#40;X&#41;;	
    	for &#40;unsigned i=1; i&#60;=&#40;year-1990&#41;/10; i++&#41;
    	{
     &nbsp;R=A*R;
     &nbsp;if &#40;i==1&#41;	R.setValue&#40;1,0, &#40;0.75*R.getValue&#40;1,0&#41; &#41; &#41;; &nbsp;
    	}
    	return R;
    }
    Matrix DanSo5&#40;const Matrix& X, const Matrix& A,const Matrix& I, unsigned year&#41;
    {
    	Matrix R&#40;X&#41;;
    	for &#40;unsigned i=1; i&#60;=&#40;year-1990&#41;/10; i++&#41;
    	{
     &nbsp;R=A*R + I;
    	}
    	return R;
    }
    int TiLeTangDS&#40;const Matrix& X, const Matrix& A,const Matrix& I, unsigned year, int Kind&#41;
    {
    	Matrix R;
    
    	if &#40;Kind==2&#41; R=DanSo2&#40;X,A,year-1&#41;;
    	if &#40;Kind==4&#41; R=DanSo4&#40;X,A,year-1&#41;;
    	if &#40;Kind==5&#41; R=DanSo5&#40;X,A,I,year-1&#41;;
    
    	double OldTotal=R.getTotal&#40;&#41;; &nbsp; &nbsp;
    
    	if &#40;Kind==2&#41; R=DanSo2&#40;X,A,year&#41;;
    	if &#40;Kind==4&#41; R=DanSo4&#40;X,A,year&#41;;
    	if &#40;Kind==5&#41; R=DanSo5&#40;X,A,I,year&#41;;
    
    	return &#40;int&#41;&#40; &#40;R.getTotal&#40;&#41; / OldTotal - 1&#41;*100 &#41;;
    }
    void DrawDiagram&#40;double Value&#41;
    {
    	for &#40;unsigned i=1; i&#60;=Value/7; i++&#41;
    	{
     &nbsp;cout&#60;&#60;&#34;_&#34;;
    	}
    	cout&#60;&#60;Value;
    }
    void DrawDiagram&#40;int year, double Value, int TiLeTang, fstream& f&#41;
    {
    	f&#60;&#60;&#34;&#60;table border=0 style=&#092;&#34;height&#58;20px&#092;&#34;&#62;&#60;thead&#62;&#60;tr&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;th&#62;&#34;&#60;&#60;year&#60;&#60;&#34;&#60;/th&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;th style=&#092;&#34;background-color&#58;MediumVioletRed;color&#58;MediumVioletRed&#092;&#34;&#62;&#34;;
    	for &#40;unsigned i=1; i&#60;=Value/7; i++&#41;
    	{
     &nbsp;f&#60;&#60;&#34;-&#34;;
    	}
    	f&#60;&#60;&#34;&#60;/th&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;th&#62;&#60;font color=MediumBlue&#62;&#34;&#60;&#60;Value&#60;&#60;&#34; &#60;/font&#62;&#60;/th&#62;&#34;;
    	if &#40;TiLeTang==36&#41;
     &nbsp;f&#60;&#60;&#34;&#60;th&#62;&#60;font color=crimson&#62;&#34;&#60;&#60;TiLeTang&#60;&#60;&#34; % &#60;/font&#62;&#60;/th&#62;&#34;;
    	else
     &nbsp;f&#60;&#60;&#34;&#60;th&#62;&#34;&#60;&#60;TiLeTang&#60;&#60;&#34; % &#60;/th&#62;&#34;;
    
    	f&#60;&#60;&#34;&#60;/tr&#62;&#60;/thead&#62;&#60;/table&#62;&#34;&#60;&#60;endl;
    }
    /* Reference
    void DrawDiagram&#40;int year, double Value, int TiLeTang, fstream& f&#41;
    {
    	f&#60;&#60;&#34;&#60;table border=0 style=&#092;&#34;height&#58;20px;width&#58;&#34;&#60;&#60;Value*50&#60;&#60;&#34;px&#092;&#34;&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;thead&#62;&#60;tr align=left&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;th&#62;&#34;&#60;&#60;year&#60;&#60;&#34;&#60;/th&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;th style=&#092;&#34;background-color&#58;blue;color&#58;blue&#092;&#34;&#62;&#60;/th&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;th&#62;&#34;&#60;&#60;TiLeTang&#60;&#60;&#34; % &#60;/th&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;/tr&#62;&#60;/thead&#62;&#60;/table&#62;&#34;;
    }*/
    
    void main&#40;&#41;
    {
    	int ArrayYear&#91;100&#93; = {0};
    	ArrayYear&#91;0&#93; = 1990;
    	ArrayYear&#91;1&#93; = 2000;
    	ArrayYear&#91;2&#93; = 2010;
    	ArrayYear&#91;3&#93; = 2020;
    	ArrayYear&#91;4&#93; = 2030;
    	unsigned sttArrayYear = 4;
    	SelectSort sort;
    	int &nbsp;year;
    
     &nbsp; &nbsp;double MA&#91;7&#93;&#91;7&#93;=
    	{
     &nbsp;{.2, 1.2, 1.1, &nbsp;.9, .1, &nbsp; 0, &nbsp;0},
     &nbsp;{.7, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp;0, &nbsp; 0, &nbsp;0},
     &nbsp;{ 0, .82, &nbsp; 0, &nbsp; 0, &nbsp;0, &nbsp; 0, &nbsp;0},
     &nbsp;{ 0, &nbsp; 0, .97, &nbsp; 0, &nbsp;0, &nbsp; 0, &nbsp;0},
     &nbsp;{ 0, &nbsp; 0, &nbsp; 0, .97, &nbsp;0, &nbsp; 0, &nbsp;0},
     &nbsp;{ 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, .9, &nbsp; 0, &nbsp;0},
     &nbsp;{ 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp;0, .87, &nbsp;0},
    	};
    	double MX&#91;7&#93;&#91;7&#93; = 
    	{
     &nbsp;{3.1, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{2.8, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{2.0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{2.5, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{2.0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{1.8, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{2.9, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
    	};
    	double MI&#91;7&#93;&#91;7&#93; = 
    	{
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
     &nbsp;{0.2, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0, &nbsp; 0},
    	};	
    
    	Matrix A&#40;MA, 7, 7&#41;, X&#40;MX, 7, 1&#41;, I&#40;MI, 7, 1&#41;, R;	
    
    	/******************
     &nbsp;* &nbsp;Introduction
     &nbsp;******************/
    	cout&#60;&#60;&#34;&#092;n &nbsp;Now we are studing the &#34;;
    	//textcolor&#40;BLUE&#41;;
    	cprintf&#40;&#34;population dynamics of &#34;&#41;;
    	//textcolor&#40;YELLOW&#41;;
    	cprintf&#40;&#34;Los Angeles&#092;n&#092;n&#34;&#41;;
    	cout&#60;&#60;&#34;&#092;n &nbsp; &nbsp; &nbsp; &nbsp; Press ALT+ENTER if you want to see in FullScreen&#092;n&#092;n&#34;;
    
    	cout&#60;&#60;&#34;The basic equation we begin with are&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34; x&#40;k+1&#41; = Ax&#40;k&#41; &nbsp; &#40;1&#41; &nbsp;k=0,1,2,... and x&#40;0&#41; given&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;with solution found iteratively to be&#092;n&#34;
     &nbsp;&#60;&#60;&#34; x&#40;k&#41; = &#40;A^k&#41;x&#40;0&#41; &#40;2&#41;&#092;n&#092;n&#34;;
    
    	cout&#60;&#60;&#34;As above, we take the unit of time to be 10 years, &#34;
     &nbsp;&#60;&#60;&#34;and take 7 age groups&#58;&#092;n 0-9, 10-19,..., 50-59, 60+&#092;n&#34;
     &nbsp;&#60;&#60;&#34;Suppose further that the population distribution &#34;
     &nbsp;&#60;&#60;&#34;as of 1990 &#40;the last cencus&#41;&#092;n&#092;n&#34;;
    	cout&#60;&#60;X&#60;&#60;&#34;&#40; x 10^5&#41;&#34;;
    
    	cout&#60;&#60;&#34;&#092;n&#092;nThe Leslie matrix, A is&#092;n&#092;n&#34;;
    	cout&#60;&#60;A;
    
    	/***********************
     &nbsp;* &nbsp;Lam viec voi file
     &nbsp;***********************/
    	fstream f;
    	f.open&#40;&#34;LosAngeles.htm&#34;, ios&#58;&#58;out | ios&#58;&#58;in | ios&#58;&#58;trunc&#41;;
    
    	if &#40;f.bad&#40;&#41; &#41; cout&#60;&#60;&#34;Problem when trying to open file &#092;&#34;LosAngeles.htm&#092;&#34; for saving the result&#34;&#60;&#60;endl;
    
    	////////////////////////////////
    	f&#60;&#60;&#34;&#60;HTML&#62;&#60;HEAD&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TITLE&#62;The population dynamics - Written by Nguyen Thanh Tung&#60;/TITLE&#62;&#60;/HEAD&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;BODY&#62;&#34;;
    	f&#60;&#60;&#34;&#60;B&#62;&#60;font size=4&#62;&#34;;
    	f&#60;&#60;&#34;&#092;n&#60;center&#62;&#60;h2&#62;The population dynamics of &#60;/h2&#62;&#60;font color=blue&#62;&#60;h1&#62;Los Angeles&#60;/h1&#62;&#60;/font&#62;&#60;/center&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;PRE&#62;&#092;n&#092;n&#34;;
    
    	f&#60;&#60;&#34;The basic equation we begin with are&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;&#60;font color=red&#62;&#34;
     &nbsp;&#60;&#60;&#34; x&#40;k+1&#41; = Ax&#40;k&#41; &nbsp; &nbsp;&#40;1&#41; &nbsp;k=0,1,2,... and x&#40;0&#41; given&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;
     &nbsp;&#60;&#60;&#34;with solution found iteratively to be&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;font color=red&#62;&#34;
     &nbsp;&#60;&#60;&#34; x&#40;k&#41; = &#40;A^k&#41;x&#40;0&#41; &nbsp;&#40;2&#41;&#092;n&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;;
    
    	f&#60;&#60;&#34;As above, we take the unit of time to be 10 years, &#34;
     &nbsp;&#60;&#60;&#34;and take 7 age groups&#58;&#092;n 0-9, 10-19,..., 50-59, 60+&#092;n&#34;
     &nbsp;&#60;&#60;&#34;Suppose further that the population distribution &#34;
     &nbsp;&#60;&#60;&#34;as of 1990 &#40;the last cencus&#41;&#092;n&#092;n&#34;;
    	f&#60;&#60;X&#60;&#60;&#34;&#40; x 10^5&#41;&#34;;
    
    	f&#60;&#60;&#34;&#092;n&#092;nThe Leslie matrix, A is&#092;n&#092;n&#34;;
    	f&#60;&#60;&#34;&#60;font color=DarkViolet&#62;&#34;
     &nbsp;&#60;&#60;A
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;;
    
    	f&#60;&#60;&#34;&#092;n&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;font color=blue&#62;&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;2.Predict&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;
     &nbsp;&#60;&#60;&#34;the population distribution will be able to calculate from equations above&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#40;See the table below&#41;&#092;n&#34;;
    
    	f&#60;&#60;&#34;&#092;n&#092;n&#34;;
    	f &nbsp; &#60;&#60;&#34;&#60;font color = blue&#62;&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;3.Remark with a long time&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;We can see the population change each year&#092;n&#092;n&#34;;
     &nbsp; &nbsp;for &#40;unsigned i=0; i&#60;=15; i++&#41;
    	{ &nbsp;	
     &nbsp;year = i*10 + 1990;
     &nbsp;R = DanSo2&#40;X, A, year&#41;; &nbsp;
    
     &nbsp;int Tang;
     &nbsp;if &#40;year==1990&#41; &nbsp; Tang=0;
     &nbsp;else
     &nbsp;{
     &nbsp;	Tang = TiLeTangDS&#40;X, A, I, year, 2&#41;;
     &nbsp;}
     &nbsp;DrawDiagram&#40;year, R.getTotal&#40;&#41; , Tang, f&#41;;
    	}
    
    	f&#60;&#60;&#34;&#092;n&#092;n&#34;;
    	f &nbsp; &#60;&#60;&#34;&#60;font color = blue&#62;&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;4.Suppose the birth rates for the second age class can be reduced by 25% by the year 2000&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;We have a little changing in 2000, make the changing next years&#092;n&#092;n&#34;;
     &nbsp; &nbsp;for &#40;i=0; i&#60;=15; i++&#41;
    	{ &nbsp;	
     &nbsp;year = i*10 + 1990;
     &nbsp;R = DanSo4&#40;X, A, year&#41;; &nbsp;
    
     &nbsp;int Tang;
     &nbsp;if &#40;year==1990&#41; &nbsp; Tang=0;
     &nbsp;else
     &nbsp;{
     &nbsp;	Tang = TiLeTangDS&#40;X, A, I, year, 4&#41;;
     &nbsp;}
     &nbsp;DrawDiagram&#40;year, R.getTotal&#40;&#41; , Tang, f&#41;;
    	}
    
    	f &nbsp; &#60;&#60;&#34;&#092;n&#092;n&#34;;
    	f &nbsp; &#60;&#60;&#34;&#60;font color=blue&#62;&#34;
     &nbsp; &nbsp; &#60;&#60;&#34; &nbsp;5.Immigrants&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;Assume that the number of immigrants &#34;
     &nbsp;&#60;&#60;&#34;are a const number with each age group.&#092;n&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;Example &#58; 0.2 x 10^5 people&#092;n&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;We have to add that number into each age group,&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;So that we have a new vector I &#58; &#092;n&#34;;
    	f &nbsp; &#60;&#60;I;
    
     &nbsp; &nbsp;f &nbsp; &#60;&#60;&#34;&#092;nNow the equation &#40;1&#41; become &#58;&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;font color=red&#62;&#34;
     &nbsp;&#60;&#60;&#34; x&#40;k+1&#41; = Ax&#40;k&#41; + I &nbsp; &nbsp; &nbsp; &#40;1.5&#41; &nbsp;k=0,1,2,... and x&#40;0&#41; given&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;&#60;/font&#62;&#34;;
    	f &nbsp; &#60;&#60;&#34;&#092;nBy recursion we can prove that equation &#40;2&#41; now become &#58;&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;font color=red&#62;&#34;
     &nbsp; &nbsp; &nbsp; &nbsp;&#60;&#60;&#34; x&#40;k&#41; = &#40;A^k&#41;*x&#40;0&#41; + &#40;A^&#40;k-1&#41;+...+1&#41;I &nbsp;&#40;2.5&#41;&#092;n&#34;
     &nbsp;&#60;&#60;&#34;&#60;/font&#62;&#34;;
    
    	f &nbsp; &#60;&#60;&#34;&#092;nThe prediction now changed.&#092;n&#092;n&#34;;	
    
    	//Table
    	f&#60;&#60;&#34;&#60;br&#62;&#60;h2&#62;&#60;font color=&#092;&#34;DarkViolet&#092;&#34;&#62;Data table&#60;/font&#62;&#60;/h2&#62;&#34;;
    	f&#60;&#60;&#34;&#60;TABLE border=1&#62;&#60;THEAD&#62;&#60;TR style=&#092;&#34;background-color&#58;darkred; color&#58;yellow; font-size&#58;12pt&#092;&#34;&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH colspan=2&#62; &nbsp; &nbsp; &#40; x 10&#60;sup&#62;5&#60;/sup&#62;&#41; &nbsp; &nbsp; &nbsp; &#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH&#62; &nbsp; &nbsp; Total &nbsp; &#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH&#62; Growth rate &#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH&#62; 0-9 &nbsp;10-19 &nbsp;20-29 &nbsp;30-39 &nbsp;40-49 &nbsp;50-59 &nbsp;60+ &#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;/TR&#62;&#60;/THEAD&#62;&#34;;
    
     &nbsp; &nbsp;/******************
     &nbsp;* &nbsp;Exercise
     &nbsp;******************/
    	char CoTiepKhong=&#39;Y&#39;;	
    	//Part One
    	
    	//Part Two
    	getch&#40;&#41;;	
    	cout&#60;&#60;&#34;&#092;n&#092;n&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;2.Predict&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;the population distribution will look like in&#092;n&#092;n&#34;;
    	
    	for &#40;i=1; i&#60;=4; i++&#41;
    	{
     &nbsp;year = 1990 + 10*i;
     &nbsp;R = DanSo2&#40;X,A,year&#41;;
     &nbsp;cout&#60;&#60;&#34; &#34;&#60;&#60;year&#60;&#60;&#34; =&#62; Total &#58; &#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp; &#60;&#60;R&#60;&#60;&#34;&#092;n&#34;;
    	}
    	
    	while &#40;toupper&#40;CoTiepKhong&#41;==&#39;Y&#39;&#41;
    	{
     &nbsp;cout&#60;&#60;&#34;Do you want to know another year &#40;Y/N&#41; ? &#34;; &nbsp;
     &nbsp;CoTiepKhong = getch&#40;&#41;;
     &nbsp;cout&#60;&#60;CoTiepKhong;
     &nbsp; &nbsp; if &#40;toupper&#40;CoTiepKhong&#41; &#33;= &#39;Y&#39;&#41; break; &nbsp;
    
     &nbsp;cout&#60;&#60;&#34;&#092;nInput the year you want to know &#58; &#34;;
     &nbsp;cin&#62;&#62;year;
     &nbsp;if &#40;year&#60;2000 || year&#62;2450 || &#40;year % 10 &#33;= 0&#41; &#41;
     &nbsp;{
     &nbsp;	cout&#60;&#60;&#34;Invalid inputed year. Condition &#58; 2000&#60;= year &#60;= 2450 and year%10==0&#092;n&#34;;
     &nbsp;	continue;
     &nbsp;}
     &nbsp;
     &nbsp;ArrayYear&#91;++sttArrayYear&#93; = year;
     &nbsp;R = DanSo2&#40;X,A,year&#41;;
     &nbsp;cout&#60;&#60;&#34; &#34;&#60;&#60;year&#60;&#60;&#34; =&#62; Total &#58; &#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp; &#60;&#60;R&#60;&#60;&#34;&#092;n&#34;;
    	}
    	CoTiepKhong = &#39;Y&#39;;
    
    	sort.Sort&#40;sttArrayYear, ArrayYear&#41;;	
     &nbsp; &nbsp;f&#60;&#60;&#34;&#60;TBODY&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TR&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 150px&#092;&#34; rowspan=&#34;&#60;&#60;sttArrayYear+1&#60;&#60;&#34;&#62;Predicts&#60;/TH&#62;&#60;TH&#62; 1990 &#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH&#62;&#34;&#60;&#60;setw&#40;10&#41;&#60;&#60;X.getTotal&#40;&#41;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH&#62;&#60;/TH&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TD&#62;&#34;&#60;&#60;X&#60;&#60;&#34;&#60;/TD&#62;&#60;/TR&#62;&#34;;
    	
    	for &#40;i=1; i&#60;=sttArrayYear; i++&#41;
    	{
     &nbsp;if &#40; ArrayYear&#91;i&#93; == ArrayYear&#91;i-1&#93; &#41; continue; &nbsp;
    
     &nbsp;R=DanSo2&#40;X, A, ArrayYear&#91;i&#93;&#41;;
     &nbsp; &nbsp; &nbsp;f&#60;&#60;&#34;&#60;TR&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH&#62;&#34;&#60;&#60;ArrayYear&#91;i&#93;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 100px&#092;&#34;&#62;&#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 100px&#092;&#34;&#62;&#34;&#60;&#60;TiLeTangDS&#40;X,A,I,ArrayYear&#91;i&#93;, 2&#41;&#60;&#60;&#34;% &#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TD&#62;&#34;&#60;&#60;R&#60;&#60;&#34;&#60;/TD&#62;&#60;/TR&#62;&#34;; &nbsp;
    	}
    
    	ArrayYear&#91;0&#93; = 1990;
    	ArrayYear&#91;1&#93; = 2000;
    	ArrayYear&#91;2&#93; = 2010;
    	ArrayYear&#91;3&#93; = 2020;
    	ArrayYear&#91;4&#93; = 2030;
    	sttArrayYear = 4;
    
    	//Part Three
    	getch&#40;&#41;;
    	cout&#60;&#60;&#34;&#092;n&#092;n&#34;;
    
     &nbsp; &nbsp;cout&#60;&#60;&#34; &nbsp;3.Remark with a long time&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;We can see the population change each year&#092;n&#092;n&#34;;
    
    	for &#40;i=0; i&#60;=11; i++&#41;
    	{
     &nbsp;cout&#60;&#60; &#40;year = i*10 + 1990&#41;&#59; &nbsp;
    
     &nbsp;R = DanSo2&#40;X, A, year&#41;; &nbsp;
     &nbsp;DrawDiagram&#40;R.getTotal&#40;&#41; &#41;;
     &nbsp;
     &nbsp;if &#40;year==1990&#41; cout&#60;&#60;endl; &nbsp;	
     &nbsp;else
     &nbsp;{
     &nbsp;	cout&#60;&#60;&#34; &nbsp; &#34;&#60;&#60;TiLeTangDS&#40;X, A, I, year, 2&#41;&#60;&#60;&#34;%&#34;&#60;&#60;endl; &nbsp;	
     &nbsp;}
    	}	
    
    	//Part Four
    	getch&#40;&#41;; 
    	cout&#60;&#60;&#34;&#092;n&#092;n&#34;;
    
     &nbsp; &nbsp;cout&#60;&#60;&#34; &nbsp;4.Birth rates for second age can be reduced by 25% by the year 2000&#092;n&#34;;
    	cout&#60;&#60;&#34;&#092;nThe prediction now changed.&#092;n&#34;
     &nbsp;&#60;&#60;&#34;The population distribution will look like in&#092;n&#092;n&#34;;
    
    	for &#40;i=1; i&#60;=4; i++&#41;
    	{
     &nbsp;year = 1990 + 10*i;
     &nbsp;R = DanSo4&#40;X,A,year&#41;;
     &nbsp;cout&#60;&#60;&#34; &#34;&#60;&#60;year&#60;&#60;&#34; =&#62; Total &#58; &#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp; &#60;&#60;R&#60;&#60;&#34;&#092;n&#34;;
    	}
    
    	while &#40;toupper&#40;CoTiepKhong&#41;==&#39;Y&#39;&#41;
    	{
     &nbsp;cout&#60;&#60;&#34;Do you want to know another year &#40;Y/N&#41; ? &#34;; &nbsp;
     &nbsp;CoTiepKhong = getch&#40;&#41;;
     &nbsp;cout&#60;&#60;CoTiepKhong;
     &nbsp; &nbsp; if &#40;toupper&#40;CoTiepKhong&#41; &#33;= &#39;Y&#39;&#41; break; &nbsp;
    
     &nbsp;cout&#60;&#60;&#34;&#092;nInput the year you want to know &#58; &#34;;
     &nbsp;cin&#62;&#62;year;
     &nbsp;if &#40;year&#60;2000 || year&#62;2450 || &#40;year % 10 &#33;= 0&#41; &#41;
     &nbsp;{
     &nbsp;	cout&#60;&#60;&#34;Invalid inputed year. Condition &#58; 2000&#60;= year &#60;= 2450 and year%10==0&#092;n&#34;;
     &nbsp;	continue;
     &nbsp;}
     &nbsp;
     &nbsp;ArrayYear&#91;++sttArrayYear&#93; = year;
     &nbsp;R = DanSo4&#40;X, A, year&#41;;
     &nbsp;cout&#60;&#60;&#34; &#34;&#60;&#60;year&#60;&#60;&#34; =&#62; Total &#58; &#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp; &#60;&#60;R&#60;&#60;&#34;&#092;n&#34;;
    	}
    	CoTiepKhong = &#39;Y&#39;;
    
    	sort.Sort&#40;sttArrayYear, ArrayYear&#41;;	
    	f&#60;&#60;&#34;&#60;TR&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH rowspan=&#34;&#60;&#60;sttArrayYear&#60;&#60;&#34;&#62;Birth rate reduced&#60;/TH&#62;&#34;;
    	for &#40;i=1; i&#60;=sttArrayYear; i++&#41;
    	{
     &nbsp;if &#40; ArrayYear&#91;i&#93; == ArrayYear&#91;i-1&#93; &#41; continue;
     &nbsp;
     &nbsp;R=DanSo4&#40;X, A, ArrayYear&#91;i&#93;&#41;;
     &nbsp; &nbsp; &nbsp;f&#60;&#60;&#34;&#60;TH&#62;&#34;&#60;&#60;ArrayYear&#91;i&#93;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 100px&#092;&#34;&#62;&#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 100px&#092;&#34;&#62;&#34;&#60;&#60;TiLeTangDS&#40;X,A,I,ArrayYear&#91;i&#93;, 4&#41;&#60;&#60;&#34;% &#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TD&#62;&#34;&#60;&#60;R&#60;&#60;&#34;&#60;/TD&#62;&#60;/TR&#62;&#34;; &nbsp;
    	}
    	
    	ArrayYear&#91;0&#93; = 1990;
    	ArrayYear&#91;1&#93; = 2000;
    	ArrayYear&#91;2&#93; = 2010;
    	ArrayYear&#91;3&#93; = 2020;
    	ArrayYear&#91;4&#93; = 2030;
    	sttArrayYear = 4;
    
    	//Part Five
    	getch&#40;&#41;; 
    	cout&#60;&#60;&#34;&#092;n&#092;n&#34;;
    
     &nbsp; &nbsp;cout&#60;&#60;&#34; &nbsp;5.Assume that the number of immigrants &#34;
     &nbsp;&#60;&#60;&#34;are a const number with each age group.&#092;n&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;Example &#58; 0.2 x 10^5 people&#092;n&#34;
     &nbsp;&#60;&#60;&#34; &nbsp;We have to add that number into each age group,&#092;n&#34;
     &nbsp; &nbsp; &#60;&#60;&#34;So that we have a new vector I &#58; &#092;n&#34;;
    	cout&#60;&#60;I;
    
    	cout&#60;&#60;&#34;&#092;nNow the equation &#40;1&#41; become &#58;&#092;n&#34;
     &nbsp;&#60;&#60;&#34; x&#40;k+1&#41; = Ax&#40;k&#41; + I &nbsp; &nbsp; &nbsp; &#40;1.5&#41; &nbsp;k=0,1,2,... and x&#40;0&#41; given&#34;;
    	cout&#60;&#60;&#34;&#092;nBy recursion we can prove that equation &#40;2&#41; now become &#58;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp;&#60;&#60;&#34; x&#40;k&#41; = &#40;A^k&#41;*x&#40;0&#41; + &#40;A^&#40;k-1&#41;+...+1&#41;I &nbsp;&#40;2.5&#41;&#092;n&#34;;
    
    	cout&#60;&#60;&#34;&#092;nThe prediction now changed.&#092;n&#34;
     &nbsp;&#60;&#60;&#34;The population distribution will look like in&#092;n&#092;n&#34;;
    
     &nbsp; &nbsp;for &#40;i=1; i&#60;=4; i++&#41;
    	{
     &nbsp;year = 1990 + 10*i;
     &nbsp;R = DanSo5&#40;X,A,I,year&#41;;
     &nbsp;cout&#60;&#60;&#34; &#34;&#60;&#60;year&#60;&#60;&#34; =&#62; Total &#58; &#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp; &#60;&#60;R&#60;&#60;&#34;&#092;n&#34;;
    	}
    
    	while &#40;toupper&#40;CoTiepKhong&#41;==&#39;Y&#39;&#41;
    	{
     &nbsp;cout&#60;&#60;&#34;Do you want to know another year &#40;Y/N&#41; ? &#34;; &nbsp;
     &nbsp;CoTiepKhong = getch&#40;&#41;;
     &nbsp;cout&#60;&#60;CoTiepKhong;
     &nbsp; &nbsp; if &#40;toupper&#40;CoTiepKhong&#41; &#33;= &#39;Y&#39;&#41; break; &nbsp;
    
     &nbsp;cout&#60;&#60;&#34;&#092;nInput the year you want to know &#58; &#34;;
     &nbsp;cin&#62;&#62;year;
     &nbsp;if &#40;year&#60;2000 || year&#62;2450 || &#40;year % 10 &#33;= 0&#41; &#41;
     &nbsp;{
     &nbsp;	cout&#60;&#60;&#34;Invalid inputed year. Condition &#58; 2000&#60;= year &#60;= 2450 and year%10==0&#092;n&#34;;
     &nbsp;	continue;
     &nbsp;}
     &nbsp;
     &nbsp;ArrayYear&#91;++sttArrayYear&#93; = year;
     &nbsp; &nbsp; &nbsp; &nbsp;R = DanSo5&#40;X,A,I,year&#41;;
     &nbsp;cout&#60;&#60;&#34; &#34;&#60;&#60;year&#60;&#60;&#34; =&#62; Total &#58; &#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#092;n&#34;
     &nbsp; &nbsp; &nbsp; &nbsp; &#60;&#60;R&#60;&#60;&#34;&#092;n&#34;;
    	}
    	CoTiepKhong = &#39;Y&#39;;
    
    	sort.Sort&#40;sttArrayYear, ArrayYear&#41;;	
    	
    	f&#60;&#60;&#34;&#60;TR&#62;&#34;
     &nbsp;&#60;&#60;&#34;&#60;TH rowspan=&#34;&#60;&#60;sttArrayYear&#60;&#60;&#34;&#62;Immigrants&#60;/TH&#62;&#34;;
    	for &#40;i=1; i&#60;=sttArrayYear; i++&#41;
    	{
     &nbsp;if &#40; ArrayYear&#91;i&#93; == ArrayYear&#91;i-1&#93; &#41; continue; &nbsp;
     &nbsp;R=DanSo5&#40;X, A, I, ArrayYear&#91;i&#93;&#41;;
     &nbsp; &nbsp; &nbsp;f&#60;&#60;&#34;&#60;TH&#62;&#34;&#60;&#60;ArrayYear&#91;i&#93;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 100px&#092;&#34;&#62;&#34;&#60;&#60;R.getTotal&#40;&#41;&#60;&#60;&#34;&#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TH style=&#092;&#34;WIDTH&#58; 100px&#092;&#34;&#62;&#34;&#60;&#60;TiLeTangDS&#40;X,A,I,ArrayYear&#91;i&#93;, 5&#41;&#60;&#60;&#34;% &#60;/TH&#62;&#34;
     &nbsp; &nbsp; &nbsp;&#60;&#60;&#34;&#60;TD&#62;&#34;&#60;&#60;R&#60;&#60;&#34;&#60;/TD&#62;&#60;/TR&#62;&#34;;
    	}
     &nbsp;
    f&#60;&#60;&#34;&#60;/TBODY&#62;&#60;/TABLE&#62;&#34;;
    	
    	ArrayYear&#91;0&#93; = 1990;
    	ArrayYear&#91;1&#93; = 2000;
    	ArrayYear&#91;2&#93; = 2010;
    	ArrayYear&#91;3&#93; = 2020;
    	ArrayYear&#91;4&#93; = 2030;
    	sttArrayYear = 4;
    	
    	f&#60;&#60;&#34;&#092;n&#092;n&#60;hr&#62;&#34;
     &nbsp;&#60;&#60;&#34; Written by Nguyen Thanh Tung&#092;n&#34;
     &nbsp;&#60;&#60;&#34; &#60;A href=&#092;&#34;mailto&#58;nguyenthanhtungtinbk@yahoo.com&#092;&#34;&#62;nguyenthanhtungtinbk@yahoo.com&#60;/A&#62;&#34;;
    	f&#60;&#60;&#34;&#60;/font&#62;&#60;/B&#62;&#60;/PRE&#62;&#34;;
    	f&#60;&#60;&#34;&#60;/BODY&#62;&#60;/HTML&#62;&#34;;
    
    	////////////////////////////////
    
    	f.close&#40;&#41;;	
    	cout&#60;&#60;&#34;&#092;n&#092;nThe result is saved in file &#092;&#34;LosAngeles.htm&#092;&#34; ...&#092;n&#34;
     &nbsp;&#60;&#60;&#34;Every time this program runs, the result &#39;s always updated.&#092;n&#34;
     &nbsp;&#60;&#60;&#34;You can open it to see&#092;n&#34;;
    	getch&#40;&#41;;
    }
    :ph34r: Tiện thể cũng xin hỏi luôn tại sao khi tui dùng hàm Inverse(const Matrix& M) lại có lỗi (ở đây để dưới dạng chú thích). Tui không hiểu lỗi này là lỗi gì.
    :7: Do trình độ non nớt, post mấy bài trước lên làm các cao thủ phản đối, các bác thông cảm.

  6. #6
    nguyenthanhtungtinbk
    Guest

    Mặc định

    Còn đây là câu hỏi khác. Có bác nào biết cách dùng JS để lí file thì post lên hoặc gửi cho tui nguyenthanhtungtinbk@yahoo.com
    Trong C++ thì điều này rất dễ với fstream, tui nghĩ trong JS cũng có vì ngôn ngữ JS khá giống C++, song do trình độ non nớt mong các cao thủ chỉ bảo giùm.

  7. #7
    obie
    Guest

    Mặc định

    Thực ra nếu chỉ với các hàm dựng sẵn của JS thì không có hàm nào sử lí file cả. Muốn thế phải có ActiveX (đã có một bài trên PCWORLDVN hay Tin học đời sống..)

    Tuy nhiên bạn có thể thử chuơng trình này của mình tai : http://obiewebsite.sf.net/o.php?Javascript...lusion_Function

  8. #8
    nguyenthanhtungtinbk
    Guest
    Sau khi được bác gợi ý, em có tìm hiểu được đoạn mã lệnh sau :
    Mã:
    var fso
    fso = new ActiveXObject&#40;&#34;Scripting.FileSystemObject&#34;&#41;;
    Đó có phải là ActiveX mà bác nói không?
    Em có biết mã lệnh trong VBScript tương đương có thể thao tác với file, chẳng hạn :
    Mã:
    Function tCreateTextFile&#40;FileName&#41;
    
     &nbsp; Dim fso
     &nbsp; Set fso = CreateObject&#40;&#34;Scripting.FileSystemObject&#34;&#41; &nbsp; 
    
     &nbsp; &#39;Tao file moi
     &nbsp; Set txtStream = fso.CreateTextFile&#40;FileName&#41;
     &nbsp; txtStream.Write&#40;&#34;Successful&#33;&#34;&#41;
     &nbsp; txtStream.Close
     &nbsp; 
     &nbsp; tCreateTextFile=true
    End Function
    Nhưng khi dùng với JS không biết phải làm thế nào, nhờ bác chỉ giùm.

  9. #9
    nguyenthanhtungtinbk
    Guest
    :c: Chiếc nón kì diệu này các bác ơi:
    http://www11.brinkster.com/nguyenthanhtung...ecNonKiDieu.htm
    ( Em chỉ nghịch tí chơi )
    Mà ở VN anh Long Vũ còn dẫn chương trình không các bác?

  10. #10
    dtvt4@k45.fet.hut.vn
    Guest

    Mặc định

    Mẹ, kinh *** đái, cái này tui kô tìm hiểu nên xem các chú làm thấy cũng hay hay. Nhưng nếu tìm hiểu cái này sâu quá --&#62; Trái bố mất ngành của mình.
    Khâm phục, khâm phục.

+ Trả lời chủ đề
Trang 1/2 12 CuốiCuối

Thông tin chủ đề

Users Browsing this Thread

Hiện có 1 người đọc bài này. (0 thành viên và 1 khách)

Chủ đề tương tự

  1. Trao đổi về JavaScript
    Gửi bởi toi yeu CNTT trong mục Lập Trình
    Trả lời: 2
    Bài cuối: 13-04-2004, 12:33 PM
  2. Trả lời: 7
    Bài cuối: 08-04-2004, 12:52 AM

Từ khóa (Tag) của chủ đề này

Quyền viết bài

  • Bạn không thể gửi chủ đề mới
  • Bạn không thể gửi trả lời
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình


About svBK.VN

    Bách Khoa Forum - Diễn đàn thảo luận chung của sinh viên ĐH Bách Khoa Hà Nội. Nơi giao lưu giữa sinh viên - cựu sinh viên - giảng viên của trường.

Follow us on

Twitter Facebook youtube