| Icshorts (3) | |
|
I have an error code of. 1>------ Build started: Project: LAB5B, Configuration: Debug Win32 ------ 1> main.cpp 1>c:\users\610pawn\documents\visual studio 2010\projects\lab5b\lab5b\main.cpp(31): error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error(425): could be 'bool std::operator !=(const std::error_code &,const std::error_condition &)' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error(432): or 'bool std::operator !=(const std::error_condition &,const std::error_code &)' 1> while trying to match the argument list '(std::string, char)' 1>c:\users\610pawn\documents\visual studio 2010\projects\lab5b\lab5b\main.cpp(31): fatal error C1903: unable to recover from previous error(s); stopping compilation ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== my code is: // PigLatin Program #include <iostream> #include <iomanip> #include <string> #include <cctype> using namespace std; string pigLatinString(string, string); int main() { cout << " Welcome to the Pig lating Program!" << endl; cout << " * You will be prompted to enter a string of * /n" << " *words. The string will be converted into * /n" << " * Pig Latin and the results displayed. * /n" << " * Enter as many as you would like. * /n" << endl; string originalString = " "; string newString = " " ; string word = " " ; size_t start =0; size_t begin =0; while ( originalString != ' ') { cout << " Enter a group of words or ENTER to quit: " << endl; getline(cin,originalString); pigLatinString(originalString, newString); cout << pigLatinString(originalString,newString); } return 0; system("pause"); } string pigLatinString(string originalString, string newString) { string word = " " ; size_t start =0; size_t begin =0; while(originalString != ' ' ) { originalString.find(' ', start); if( start == string::npos) return 0; else originalString.substr(begin,start - begin) = word; word.substr(0,1) + "ay" + ' ' = newString; start ++; begin = start; } word = originalString.find(begin, start - begin); cout << word << endl; word.substr(0,1) + "ay" + ' ' = newString; return newString; } I can't figure out why it won't accept the != | |
|
Last edited on
|
|