KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have some code that I'm trying to work on... #include <iostream> #include <string> int main() { std::cout << "Hello. Welcome to Delicious Drive Up. What would you like to order?\n"; std::cout << "\nOur menu is-"; std::cout << "..."; std::cout << "\nOrder here > "; std::string choice; std::getline(cin, choice); if (choice == 'hamburger' || choice == 'Hamburger') { std::cout << "We don't have any ham. Is a Chickenburger all right? y/n. > "; std::string opt; std::getline(cin, opt); if (opt == 'y' || opt == 'Y' || opt == 'yes' || opt = 'Yes') { std::cout << "Here's your chickenburger."; } } } This was adapted from a Bash script I wrote and is one of my first C++ programs. When I compile this, it comes up with these errors... test.cpp:19:15: warning: character constant too long for its type test.cpp:19:40: warning: character constant too long for its type test.cpp:23:44: warning: multi-character character constant test.cpp:23:59: warning: multi-character character constant test.cpp: In function ‘int main()’: test.cpp:19: error: no match for ‘operator==’ in ‘choice == 1919378802’ test.cpp:19: error: no match for ‘operator==’ in ‘choice == 1919378802’ test.cpp:23: error: no match for ‘operator==’ in ‘opt == 'y'’ test.cpp:23: error: no match for ‘operator==’ in ‘opt == 'Y'’ test.cpp:23: error: no match for ‘operator==’ in ‘opt == 7955827’ Could you explain what these mean and how to fix them? EDIT: I get a new error message now... .test.cpp: In function ‘int main()’: .test.cpp:23: error: no match for ‘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<ch
Tags (comma-separated)
Save Edits
Cancel