Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":13953,"date":"2015-05-06T14:14:41","date_gmt":"2015-05-06T19:14:41","guid":{"rendered":"https:\/\/mauriciocoopera.withknown.com\/2015\/mastery-26"},"modified":"2015-05-06T14:14:41","modified_gmt":"2015-05-06T19:14:41","slug":"mastery-26-11","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/mastery-26-11\/","title":{"rendered":"Mastery 26"},"content":{"rendered":"
\n

Creation and use of matrixes in C++<\/span>\u00a0(multi – dimensional arrays)<\/p>\n

Two-Dimensional Arrays:<\/h2>\n

The simplest form of the multidimensional array is the two-dimensional array. A two-dimensional array is, in essence, a list of one-dimensional arrays. To declare a two-dimensional integer array of size x,y, you would write something as follows:<\/p>\n

#d6d6d6;\">type arrayName <\/span>[<\/span> x <\/span>][<\/span> y <\/span>];<\/span><\/pre>\n

Where\u00a0type<\/strong>\u00a0can be any valid C++ data type and\u00a0arrayName<\/strong>\u00a0will be a valid C++ identifier.<\/p>\n

A two-dimensional array can be think as a table, which will have x number of rows and y number of columns. A 2-dimensional array\u00a0a<\/strong>, which contains three rows and four columns can be shown as below:<\/p>\n

\"Mastery<\/center><\/p>\n

Thus, every element in array a is identified by an element name of the form\u00a0a[ i ][ j ]<\/strong>, where a is the name of the array, and i and j are the subscripts that uniquely identify each element in a.<\/p>\n

Initializing Two-Dimensional Arrays:<\/h2>\n

Multidimensioned arrays may be initialized by specifying bracketed values for each row. Following is an array with 3 rows and each row have 4 columns.<\/p>\n

#d6d6d6;\">int<\/span> a<\/span>[<\/span>3<\/span>][<\/span>4<\/span>]<\/span> =<\/span> {<\/span>  \n {<\/span>0<\/span>,<\/span> 1<\/span>,<\/span> 2<\/span>,<\/span> 3<\/span>}<\/span> ,<\/span>   \/*  initializers for row indexed by 0 *\/<\/span>\n {<\/span>4<\/span>,<\/span> 5<\/span>,<\/span> 6<\/span>,<\/span> 7<\/span>}<\/span> ,<\/span>   \/*  initializers for row indexed by 1 *\/<\/span>\n {<\/span>8<\/span>,<\/span> 9<\/span>,<\/span> 10<\/span>,<\/span> 11<\/span>}<\/span>   \/*  initializers for row indexed by 2 *\/<\/span>\n};<\/span><\/pre>\n

The nested braces, which indicate the intended row, are optional. The following initialization is equivalent to previous example:<\/p>\n

#d6d6d6;\">int<\/span> a<\/span>[<\/span>3<\/span>][<\/span>4<\/span>]<\/span> =<\/span> {<\/span>0<\/span>,<\/span>1<\/span>,<\/span>2<\/span>,<\/span>3<\/span>,<\/span>4<\/span>,<\/span>5<\/span>,<\/span>6<\/span>,<\/span>7<\/span>,<\/span>8<\/span>,<\/span>9<\/span>,<\/span>10<\/span>,<\/span>11<\/span>};<\/span><\/pre>\n

Accessing Two-Dimensional Array Elements:<\/h2>\n

An element in 2-dimensional array is accessed by using the subscripts, i.e., row index and column index of the array. For example:<\/p>\n

#d6d6d6;\">int<\/span> val <\/span>=<\/span> a<\/span>[<\/span>2<\/span>][<\/span>3<\/span>];<\/span><\/pre>\n

The above statement will take 4th element from the 3rd row of the array. You can verify it in the above digram.<\/p>\n

#d6d6d6;\">#include<\/a><\/span> <\/iostream><\/span>\nusing<\/span> namespace<\/span> std<\/span>;<\/span>\n \nint<\/span> main <\/span>()<\/span>\n{<\/span>\n   \/\/ an array with 5 rows and 2 columns.<\/span>\n   int<\/span> a<\/span>[<\/span>5<\/span>][<\/span>2<\/span>]<\/span> =<\/span> {<\/span> {<\/span>0<\/span>,<\/span>0<\/span>},<\/span> {<\/span>1<\/span>,<\/span>2<\/span>},<\/span> {<\/span>2<\/span>,<\/span>4<\/span>},<\/span> {<\/span>3<\/span>,<\/span>6<\/span>},{<\/span>4<\/span>,<\/span>8<\/span>}};<\/span>\n \n   \/\/ output each array element's value                      <\/span>\n   for<\/span> (<\/span> int<\/span> i <\/span>=<\/span> 0<\/span>;<\/span> i <\/span> 5<\/span>;<\/span> i<\/span>++<\/span> )<\/span>\n      for<\/span> (<\/span> int<\/span> j <\/span>=<\/span> 0<\/span>;<\/span> j <\/span> 2<\/span>;<\/span> j<\/span>++<\/span> )<\/span>\n      {<\/span>\n         cout <\/span> \"a[\"<\/span>  i <\/span> \"][\"<\/span>  j <\/span> \"]: \"<\/span>;<\/span>\n         cout <\/span> a<\/span>[<\/span>i<\/span>][<\/span>j<\/span>] endl<\/span>;<\/span>\n      }<\/span>\n \n   return<\/span> 0<\/span>;<\/span>\n}<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/pre>\n

When the above code is compiled and executed, it produces the following result:<\/p>\n

#d6d6d6;\">a<\/span>[<\/span>0<\/span>][<\/span>0<\/span>]:<\/span> 0<\/span>\na<\/span>[<\/span>0<\/span>][<\/span>1<\/span>]:<\/span> 0<\/span>\na<\/span>[<\/span>1<\/span>][<\/span>0<\/span>]:<\/span> 1<\/span>\na<\/span>[<\/span>1<\/span>][<\/span>1<\/span>]:<\/span> 2<\/span>\na<\/span>[<\/span>2<\/span>][<\/span>0<\/span>]:<\/span> 2<\/span>\na<\/span>[<\/span>2<\/span>][<\/span>1<\/span>]:<\/span> 4<\/span>\na<\/span>[<\/span>3<\/span>][<\/span>0<\/span>]:<\/span> 3<\/span>\na<\/span>[<\/span>3<\/span>][<\/span>1<\/span>]:<\/span> 6<\/span>\na<\/span>[<\/span>4<\/span>][<\/span>0<\/span>]:<\/span> 4<\/span>\na<\/span>[<\/span>4<\/span>][<\/span>1<\/span>]:<\/span> 8<\/span><\/pre>\n

As explained above, you can have arrays with any number of dimensions, although it is likely that most of the arrays you create will be of one or two dimensions.<\/p>\n

Credits:<\/p>\n

<\/a>http:\/<\/wbr>\/<\/wbr>www.tutorialspoint.com\/<\/wbr>cplusplus\/<\/wbr>cpp_multi_dimensional_arrays.htm<\/a><\/span><\/p>\n

#TC<\/a>1017 #Mastery<\/a>26<\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

\n

Creation and use of matrixes in C++<\/span> (multi – dimensional arrays)<\/p>\n

Two-Dimensional Arrays:<\/h2>\n

The simplest form of the multidimensional array is the two-dimensional array. A two-dimensional array is, in essence, a list of one-dimensional arrays. To declare a two-dimensional integer array of size x,y, you would write something as follows:<\/p>\n

#d6d6d6;\">type arrayName <\/span>[<\/span> x <\/span>][<\/span> y <\/span>];<\/span><\/pre>\n

Where type<\/strong> can be any valid C++ data type and arrayName<\/strong> will be a valid C++ identifier.<\/p>\n

A two-dimensional array can be think as a table, which will have x number of rows and y number of columns. A 2-dimensional array a<\/strong>, which contains three rows and four columns can be shown as below:<\/p>\n<\/p>\n

Thus, every element in array a is identified by an element name of the form a[ i ][ j ]<\/strong>, where a is the name of the array, and i and j are the subscripts that uniquely identify each element in a.<\/p>\n

Initializing Two-Dimensional Arrays:<\/h2>\n

Multidimensioned arrays may be initialized by specifying bracketed values for each row. Following is an array with 3 rows and each row have 4 columns.<\/p>\n

#d6d6d6;\">int<\/span> a<\/span>[<\/span>3<\/span>][<\/span>4<\/span>]<\/span> =<\/span> {<\/span>  \n {<\/span>0<\/span>,<\/span> 1<\/span>,<\/span> 2<\/span>,<\/span> 3<\/span>}<\/span> ,<\/span>   \/*  initializers for row indexed by 0 *\/<\/span>\n {<\/span>4<\/span>,<\/span> 5<\/span>,<\/span> 6<\/span>,<\/span> 7<\/span>}<\/span> ,<\/span>   \/*  initializers for row indexed by 1 *\/<\/span>\n {<\/span>8<\/span>,<\/span> 9<\/span>,<\/span> 10<\/span>,<\/span> 11<\/span>}<\/span>   \/*  initializers for row indexed by 2 *\/<\/span>\n};<\/span><\/pre>\n

The nested braces, which indicate the intended row, are optional. The following initialization is equivalent to previous example:<\/p>\n

#d6d6d6;\">int<\/span> a<\/span>[<\/span>3<\/span>][<\/span>4<\/span>]<\/span> =<\/span> {<\/span>0<\/span>,<\/span>1<\/span>,<\/span>2<\/span>,<\/span>3<\/span>,<\/span>4<\/span>,<\/span>5<\/span>,<\/span>6<\/span>,<\/span>7<\/span>,<\/span>8<\/span>,<\/span>9<\/span>,<\/span>10<\/span>,<\/span>11<\/span>};<\/span><\/pre>\n

Accessing Two-Dimensional Array Elements:<\/h2>\n

An element in 2-dimensional array is accessed by using the subscripts, i.e., row index and column index of the array. For example:<\/p>\n

#d6d6d6;\">int<\/span> val <\/span>=<\/span> a<\/span>[<\/span>2<\/span>][<\/span>3<\/span>];<\/span><\/pre>\n

The above statement will take 4th element from the 3rd row of the array. You can verify it in the above digram.<\/p>\n

#d6d6d6;\">#include<\/a><\/span> <\/span>\nusing<\/span> namespace<\/span> std<\/span>;<\/span>\n \nint<\/span> main <\/span>()<\/span>\n{<\/span>\n   \/\/ an array with 5 rows and 2 columns.<\/span>\n   int<\/span> a<\/span>[<\/span>5<\/span>][<\/span>2<\/span>]<\/span> =<\/span> {<\/span> {<\/span>0<\/span>,<\/span>0<\/span>},<\/span> {<\/span>1<\/span>,<\/span>2<\/span>},<\/span> {<\/span>2<\/span>,<\/span>4<\/span>},<\/span> {<\/span>3<\/span>,<\/span>6<\/span>},{<\/span>4<\/span>,<\/span>8<\/span>}};<\/span>\n \n   \/\/ output each array element's value                      <\/span>\n   for<\/span> (<\/span> int<\/span> i <\/span>=<\/span> 0<\/span>;<\/span> i <\/span> 5<\/span>;<\/span> i<\/span>++<\/span> )<\/span>\n      for<\/span> (<\/span> int<\/span> j <\/span>=<\/span> 0<\/span>;<\/span> j <\/span> 2<\/span>;<\/span> j<\/span>++<\/span> )<\/span>\n      {<\/span>\n         cout <\/span> \"a[\"<\/span>  i <\/span> \"][\"<\/span>  j <\/span> \"]: \"<\/span>;<\/span>\n         cout <\/span> a<\/span>[<\/span>i<\/span>][<\/span>j<\/span>] endl<\/span>;<\/span>\n      }<\/span>\n \n   return<\/span> 0<\/span>;<\/span>\n}<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/pre>\n

When the above code is compiled and executed, it produces the following result:<\/p>\n

#d6d6d6;\">a<\/span>[<\/span>0<\/span>][<\/span>0<\/span>]:<\/span> 0<\/span>\na<\/span>[<\/span>0<\/span>][<\/span>1<\/span>]:<\/span> 0<\/span>\na<\/span>[<\/span>1<\/span>][<\/span>0<\/span>]:<\/span> 1<\/span>\na<\/span>[<\/span>1<\/span>][<\/span>1<\/span>]:<\/span> 2<\/span>\na<\/span>[<\/span>2<\/span>][<\/span>0<\/span>]:<\/span> 2<\/span>\na<\/span>[<\/span>2<\/span>][<\/span>1<\/span>]:<\/span> 4<\/span>\na<\/span>[<\/span>3<\/span>][<\/span>0<\/span>]:<\/span> 3<\/span>\na<\/span>[<\/span>3<\/span>][<\/span>1<\/span>]:<\/span> 6<\/span>\na<\/span>[<\/span>4<\/span>][<\/span>0<\/span>]:<\/span> 4<\/span>\na<\/span>[<\/span>4<\/span>][<\/span>1<\/span>]:<\/span> 8<\/span><\/pre>\n

As explained above, you can have arrays with any number of dimensions, although it is likely that most of the arrays you create will be of one or two dimensions.<\/p>\n

Credits:<\/p>\n

<\/a>http:\/\/www.tutorialspoint.com\/cplusplus\/cpp_multi_dimensional_arrays.htm<\/a><\/span><\/p>\n

#TC<\/a>1017 #Mastery<\/a>26<\/span><\/p>\n<\/div>\n

Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":115,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,26],"tags":[161,395,520,519,517,144,396,397,394,234,213,95,243,486,40,287],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13953"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/comments?post=13953"}],"version-history":[{"count":6,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13953\/revisions"}],"predecessor-version":[{"id":19153,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13953\/revisions\/19153"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=13953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=13953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=13953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}