You have two ways to fix this. The preferred way is to use:
string answer;
(instead of char
). The other possible way to fix it is:
if (answer == 'y') ...
(note single quotes instead of double, representing a char
constant).
Related Posts:
- error: expected unqualified-id error: Meaning and fix? [duplicate]
- error: redefinition of class
- C++ Error: No match for ‘operator=’
- Identifier not found error on function call
- What is an ‘undeclared identifier’ error and how do I fix it?
- Identifier not found error on function call
- What is an ‘undeclared identifier’ error and how do I fix it?
- C ++ error: a expected initializer before [function name]
- invalid new-expression of abstract class type
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- “Symbol(s) not found for architecture x86_64” on QtCreator project
- error: redefinition of class
- C++ error: “Array must be initialized with a brace enclosed initializer”
- error: expected primary-expression before ‘)’ token (C)
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- Resolve build errors due to circular dependency amongst classes
- C++ error: definition of implicitly-declared
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- extra qualification error in C++
- Cannot open output file, permission denied
- Call to non-static member function without an object argument compiler error
- Error “Unterminated conditional directive” in cross-referencing headers
- multiple definitions error in c++ and solution to solve this issue
- Stray ‘\342’ in C++ program
- System not declared in scope?
- Error in assignment of member in read-only object
- Call of overloaded function is ambiguous
- error: ISO C++ forbids in-class initialization of non-const static member
- Error: expression cannot be used as a function?
- Unexpected end of file error
- virtual memory exhausted: Cannot allocate memory
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- What is a segmentation fault?
- Sleep for milliseconds
- C++ Cout & Cin & System “Ambiguous” [closed]
- How to read a file line by line or a whole text file at once?
- Split a string using C++11
- How to track down a “double free or corruption” error
- undefined reference to `WinMain@16′
- How do I declare a 2d array in C++ using new?
- What does “#include
” do? - How to convert an instance of std::string to lower case
- Error: No viable overloaded =
- Random number between 1 to 10 using C++
- Expected initializer before namespace
- Use of “this” keyword in C++
- Why am I getting “undefined reference to main”
- Compiling C++11 with g++
- Setting an int to Infinity in C++
- What exactly is std::atomic?
- Separating class code into a header and cpp file
- Deep copy vs Shallow Copy
- Pointer to incomplete class type is not allowed
- Sorting Characters Of A C++ String
- Sentinel while loop for C++
- How to ensure that a std::map is ordered?
- How to write C++ getters and setters
- std::out_of_range error?
- Checking cin input stream produces an integer
- Where do “pure virtual function call” crashes come from?
- C++ wait for user input
- non-standard syntax; use ‘&’ to create a pointer to member
- How to shuffle a std::vector?
- Understanding glm::lookAt()
- How to get current timestamp in milliseconds since 1970 just the way Java gets
- What is the best open XML parser for C++?
- *** No rule to make target ‘class.cpp’, needed by `build/….x86/class.o` Stop. error in Ubuntu
- What’s the difference between opening a file with ios::binary or ios::out or both?
- Hash function for a string
- CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
- How to run valgrind with basic c example?
- Creation of Dynamic Array of Dynamic Objects in C++
- Compiling simple Hello World program on OS X via command line
- Strange error C2131: expression did not evaluate to a constant in VC 2015
- error: called object type ‘int’ is not a function or function pointer
- Hash function for a string
- Is there a replacement for unistd.h for Windows (Visual C)?
- What is wrong with using goto?
- Double pointer array in c++
- Don’t understand static boolean behavior
- How to write std::string to file?
- Member declaration not found
- What is the difference between a .cpp file and a .h file?
- Stable Cotangent
- The CXX compiler identification is unknown
- Is there a standard sign function (signum, sgn) in C/C++?
- C++ compiler error: “return type specification for constructor invalid”
- Function call missing argument list to create pointer
- cannot specify explicit initializer for arrays
- What does ** mean in C++?
- Incomplete type is not allowed: stringstream
- Initializing default values in a struct
- Warning: comparison of distinct pointer types
- MinGW .exe requires a few gcc dll’s regardless of the code?
- Converting bool to text in C++
- clearing a vector of pointers [duplicate]
- Evaluate a string with a switch in C++ [duplicate]
- C++ JSON Serialization
- stack around the variable…was corrupted
- Creating a list to hold objects in C++