Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <array> //this a new library to use the alternative array
- //eclipse seems to consider the library arrays as falsely call the errors which can be annoying for debugging
- using namespace std;
- void titato (string a[][]) { //notice that now you can leave both [] empty
- int n;
- int m;
- string d;
- for ( m = 0; m<a.size(); ++m){ //one advantage of the library array is that you can find its size easily by 'name of array here'.size
- for ( n = 0; n<3; ++n) {
- d = a[m][n];
- cout << d << " ";
- }
- cout << endl;
- }
- }
- int main() {
- array<int,5> numbers = {16, 27, 7, 40, 12071}; //this is another way to declare an array and is more accurate
- int x = numbers[0];
- int n;
- array<array<int,3>,3> tic = {{"x", "o", "x"}, {"x", "o", "x"}, {"o", "x", "o"}};
- cout << x << endl;
- numbers[0] = 1;
- x = numbers[0];
- cout << x << endl;
- for ( n=0 ; n<numbers.size() ; ++n ) {
- cout << numbers[n] << " " << endl;
- }
- titato(tic);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement