Searching through an array until a certain string or 0

removed
Last edited on
If you are using C++0x/C++11 this can be done with the new and improved for loops

1
2
3
4
5
6
7
8
9
10
11
12

for (TLink i : monkA) {

  // proccess the data
  if (i.mkey == "text to trigger") {

    // do crazy stuff

  }

}


if not using C++11...

1
2
3
4
5
6
7
8
9
10
11
12

for (int i; i <= 63 /* OR AMOUNT OF ELEMENTS IN THE ARRAY */ ; i++) {

  // proccess the data
  if (monkA[i].mkey == "text to trigger") {

    // do crazy stuff

  }

}


Excuse the spaces instead of tabs...
How do I know what version of C++ I'm using?
removed
Last edited on
Topic archived. No new replies allowed.