Search:

Type: Posts; User: Neo1

Search: Search took 0.01 seconds.

  1. Replies
    17
    Views
    2,112

    This is more or less what i had in mind: ...

    This is more or less what i had in mind:



    unsigned int count = 0;
    std::size_t found = str.find("gc");
    while(found != std::string::npos)
    {
    found = str.find("gc", found + 2);
    ++count;
  2. Replies
    17
    Views
    2,112

    Yes i suppose it could seem slightly...

    Yes i suppose it could seem slightly counterintuitive to use find like this. If you were just looking for a simple value i would suggest std::count but since you are actually looking for a sequence...
  3. Replies
    17
    Views
    2,112

    You need a closing bracket '}' on line 32 and...

    You need a closing bracket '}' on line 32 and line 25 in the code i posted. Without these the program will not do as you intend.

    Also as i mentioned earlier, you're indexing your string one past...
  4. Replies
    17
    Views
    2,112

    #include #include ...

    #include <iostream>
    #include <string>


    using namespace std;


    int main ()
    {
    string input;
  5. Replies
    17
    Views
    2,112

    So the first thing i will mention is your...

    So the first thing i will mention is your indentation, it is very inconsistent. As a result of this, you have a bunch of mismatched brackets, they are all over the place. Fix your indentation and you...
Results 1 to 5 of 5