Find and delete a string in a vector of strings in C++
<p>I'm trying to find a 2 part name in a vector of strings and I have what I thought would work and it doesn't. I can not use iterators. This is my code, it is part of a larger program, it's a single function in a program with 5 functions.</p>

<pre><code>int deletenames()
{
    ifstream inFile;
    ofstream outFile;
    string strFileName;
    string strFName,strLName;
    vector&lt;string&gt; vecStudent;
    string strDFName, strDLName;
    int i=0;
    char line[80];
    //delets a name
    cout &lt;&lt; endl&lt;&lt; " Enter a name to be deleted( First and Last Name):";
    cin&gt;&gt;strDFName&gt;&gt;strDLName;

    for(i&lt;0;strDFName+ " "+strDLName=strFName+ " "+strLName; i++)
    {
        if(strDFName+ " "+strDLName=strFName+ " "+strLName)
            {
                vecStudent.erase;
                cout &lt;&lt; "Student Deleted";
        }
    }

    // open output file for writing
    outFile.open(strFileName.c_str());
    if ( outFile.fail())
    {
        cout&lt;&lt;" Output file error! Student was not added"&lt;&lt;endl;
        return -1;
    }

    //display the content of the vector
    for(int i=0; i&lt;vecStudent.size(); i++)
        cout&lt;&lt; vecStudent[i]&lt;&lt;endl;

    for(int i=0; i&lt;vecStudent.size();i++)
        outFile&lt;&lt;vecStudent[i]&lt;&lt;endl;
    outFile.close();
return 0;
}
</code></pre>

<p>I get the following error messages from Microsoft Visual Studio That I'm using to compile it. </p>

<pre><code>main.cpp
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(78): warning C4018: '&lt;' : signed/unsigned mismatch
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(64): warning C4101: 'line' : unreferenced local variable
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(105): warning C4018: '&lt;' : signed/unsigned mismatch
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(108): warning C4018: '&lt;' : signed/unsigned mismatch
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(90): warning C4101: 'line' : unreferenced local variable
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(132): warning C4018: '&lt;' : signed/unsigned mismatch
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(135): warning C4018: '&lt;' : signed/unsigned mismatch
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(122): warning C4101: 'line' : unreferenced local variable
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(158): warning C4552: '&lt;' : operator has no effect; expected operator with side-effect
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(158): error C2451: conditional expression of type 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;' is illegal
1&gt;          with
1&gt;          [
1&gt;              _Elem=char,
1&gt;              _Traits=std::char_traits&lt;char&gt;,
1&gt;              _Ax=std::allocator&lt;char&gt;
1&gt;          ]
1&gt;          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(160): error C2451: conditional expression of type 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;' is illegal
1&gt;          with
1&gt;          [
1&gt;              _Elem=char,
1&gt;              _Traits=std::char_traits&lt;char&gt;,
1&gt;              _Ax=std::allocator&lt;char&gt;
1&gt;          ]
1&gt;          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(162): error C3867: 'std::vector&lt;_Ty&gt;::erase': function call missing argument list; use '&amp;std::vector&lt;_Ty&gt;::erase' to create a pointer to member
1&gt;          with
1&gt;          [
1&gt;              _Ty=std::string
1&gt;          ]
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(179): warning C4018: '&lt;' : signed/unsigned mismatch
1&gt;c:\users\ace\desktop\cpsc 1103 assingment 4\cpsc 1103 assingment 4\main.cpp(182): warning C4018: '&lt;' : signed/unsigned mismatch
</code></pre>
