c++ syntax compiling error -
i new programmer whos run compilling error dont understand , hoping somone can me understand why error
31 f:\c++ programming\chapter 13\exercises\exercise 32.cpp no match 'operator||' in '(((std::operator== [with _chart = char, _traits = std::char_traits<char>, _alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(&letter))), ((const char*)"a")) || std::operator== [with _chart = char, _traits = std::char_traits<char>, _alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(&letter))), ((const char*)"e"))) || std::operator== [with _chart = char, _traits = std::char_traits<char>, _alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(&letter))), ((const char*)"i"))) || std::operator== [with _chart = char, _traits = std::char_traits<char>, _alloc = std::allocator<char>](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)(&letter))), ((const char*)"o"))) || letter'
code
#include <iostream> #include <string> using namespace std; main() { string word = ""; string letter = " "; int count = 7; string temp = ""; int x = 0; //end declair cout << "please enter word: "; getline(cin, word); count = word.length(); letter = word.substr(0, 1); if(letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u") { word.insert(count, "-way"); cout <<"word starting vowel "<<word<<endl; } while(letter != "a" && letter != "e" && letter != "i" && letter != "o" && letter != "u"|| letter == "y") { x = 0; while(x < count) { letter = word.substr(0, 1); word.insert(count, "-"); if(letter == "a" || letter == "e" || letter == "i" || letter == "o" ||//error here letter || "u"|| letter == "y") //error iss here { temp = letter; cout <<letter <<" ------------------------"<<endl; word.erase(x, 1); cout <<word <<" ------------------------"<<endl; word.insert(x, letter); cout <<word <<" ------------------------"<<endl; letter = word.substr(0, 1); } x += 1; } cout <<"word starting letter "<<word<<endl; } system("pause"); }
|| letter || "u")//
// try
|| letter == "u")//
Comments
Post a Comment