Home > Uncategorized > code

code

April 22nd, 2009

<!– /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:”Cambria Math”; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:新宋体; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:”\@新宋体”; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:”\@宋体”; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:”"; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:”Calibri”,”sans-serif”; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:”Times New Roman”; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-bidi-font-family:”Times New Roman”; mso-bidi-theme-font:minor-bidi;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} –>

//—————————————————————————-

//! TSArray.h

//!

//! Author: Yuge Zhou SUID: 973916484

//!

//! @file

//!

//! @brief This file defines the Class TSArray.

//!

//! This class provides a basic function to implement the three-dimensioned array.

//! This single-dimensioned array can accece the element use three index in each dimension.

//! and user can also chang the size of the array according to user’s wishes.

//! user can use << and >> to add the data of the array easily.

//!

//! This class use the NodeSLList.h and IntNode.h

//! to help implement the function

//—————————————————————————-

#ifndef _H_TSARRAY_

#define _H_TSARRAY_

#include“NodeSLList.h”

#include <iostream>

using std::ostream ;

using std::istream;

//—————————————————————————

//! @brief This class provides a basic function to implement the Three-dimensioned array..

//—————————————————————————

class TSArray

{

//—————————————————————————-

//! @brief Define the << operator the help output the detail of the array

//!

//! @param output the output ostream;

//! @param tsarray the TSArray object which need to be outputed

//! @return The ostream

//—————————————————————————-

friend ostream &operator<<(ostream& output, const TSArray & tsarray);

//—————————————————————————-

//! @brief Define the >> operator the help input the data of the array

//!

//! @param input the input ostream;

//! @param tsarray the TSArray object which need to be inputed

//! @return The istream

//—————————————————————————-

friend istream &operator>>(istream& input , TSArray & tsarray);

public:

//—————————————————————————-

//! @brief Constructor : Creates the Board object.

//!

//! @param rows The number of rows of the Three-dimensioned array

//! @param columns The number of rocolumnsws of the Three-dimensioned array

//! @param depth The number of depth of the Three-dimensioned array

//—————————————————————————-

TSArray(int rows=0, int columns=0, int depth=0);

//—————————————————————————-

//! @brief Destructor: deletes TSArray object.

//—————————————————————————-

~TSArray();

//—————————————————————————-

//! @brief Define the () operator the get data of element the array

//!

//! @param row The number of the row of the Three-dimensioned array

//! @param column The number of the columnsws of the Three-dimensioned array

//! @param depth The number of the depth of the Three-dimensioned array

//!

//! @return The value of the array element

//—————————————————————————-

int operator()( int row=1, int column=1, int depth=1) const;

//—————————————————————————-

//! @brief Define the () operator the get data of element the array

//!

//! @param row The number of the row of the Three-dimensioned array

//! @param column The number of the columnsws of the Three-dimensioned array

//! @param depth The number of the depth of the Three-dimensioned array

//!

//! @return The reference of the array element

//—————————————————————————-

int &operator()( int row=1, int column=1, int depth=1);

//—————————————————————————-

//! @brief Define the = operator the refined the assignment function

//!

//! @param right The TSArray object need to be assigned.

//!

//! @return The reference of left object

//—————————————————————————-

const TSArray & operator=(const TSArray &right );

//—————————————————————————-

//! @brief Define the == operator to compare the TSArray object

//!

//! @param right The TSArray object need to be compared.

//!

//! @return equality always return FALSE for different-sized arrays

//—————————————————————————-

bool operator==( const TSArray &right) const;

//—————————————————————————-

//! @brief Define the != operator to compare the TSArray object

//!

//! @param right The TSArray object need to be compared.

//!

//! @return inequality always return TRUE for different-sized arrays

//—————————————————————————-

bool operator!=( const TSArray &right) const

{

return ! ( *this == right ); // invokes Array::operator==

}

//—————————————————————————-

//! @brief This will dynamically change the size of the array in any or all dimensions.

//! When the array is made larger in any dimension, existing elements will not be

//! affected. When the array is made smaller in any dimension, existing elements

//! will be truncated (pruned) in that dimension.

//!

//! @param row The number of the row of the Three-dimensioned array

//! @param column The number of the columnsws of the Three-dimensioned array

//! @param depth The number of the depth of the Three-dimensioned array

//—————————————————————————-

void ChangeSize(int row, int column, int depth);

private:

//Record the size of the three-dimensioned array

int rowsMax, columnsMax, depthMax, init;

//The data container

NodeSLList *ns;

};

#endif

Author: tanker Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.