Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <array>
- using namespace std;
- void titato (string a[][3]) { //to use a multidimensional array as parameters you need to make sure you put the number in the last []
- int n;
- int m;
- string d;
- for ( m = 0; m<3; ++m){
- for ( n = 0; n<3; ++n) {
- d = a[m][n];
- cout << d << " ";
- }
- cout << endl;
- }
- }
- int main() {
- int numbers[5] = {16, 27, 7, 40, 12071}; //this is an ordinary array
- int x = numbers[0];
- int n;
- string tic[3][3] = {{"x", "o", "x"}, {"x", "o", "x"}, {"o", "x", "o"}}; //this is a multidimensional array
- cout << x << endl;
- numbers[0] = 1;
- x = numbers[0];
- cout << x << endl;
- for ( n=0 ; n<5 ; ++n ) {
- cout << numbers[n] << " " << endl;
- }
- titato(tic);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement