fork download
  1. #include <vector>
  2. #include <string>
  3. #include <iostream>
  4. #include <algorithm>
  5. using namespace std;
  6. int main()
  7. {
  8. string name = "CS";
  9. vector<vector<string> > ptextarr = {{"CS", "NOTHING"}, {"DS", "NOTHING"}, {"SS", "NOTHING"}, {"ES", "NOTHING"}, {"GS", "NOTHING"}, {"FS", "NOTHING"}};
  10. for(size_t n = 0; n < ptextarr.size(); ++n)
  11. {
  12. auto i = find(ptextarr[n].begin(), ptextarr[n].end(), name);
  13. if(ptextarr[n].end() != i)
  14. std::cout << "Found root at row " << n << " col " << i-ptextarr[n].begin() << '\n';
  15. }
  16. }
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
Found root at row 0 col 0