Searching through an array until a certain string or 0

Oct 30, 2011 at 3:50pm
removed
Last edited on Nov 27, 2011 at 8:47pm
Oct 30, 2011 at 5:23pm
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...
Oct 30, 2011 at 9:48pm
How do I know what version of C++ I'm using?
Oct 31, 2011 at 5:20pm
removed
Last edited on Nov 27, 2011 at 8:47pm
Topic archived. No new replies allowed.