You need to include the string library, you also need to provide a return type for your main function and your implementation may require you to declare an explicit return statement for main (some implementations add an implicit one if you don’t explicitly provide one); like so:
#include <iostream> #include <string> //this is the line of code you are missing using namespace std; int main()//you also need to provide a return type for your main function { string password; cin >> password; if (password == "Lieutenant") { cout << "Correct!" << endl; } else { cout << "Wrong!" << endl; } return 0;//potentially optional return statement }
Related Posts:
- Cannot open output file, permission denied
- error: expected unqualified-id error: Meaning and fix? [duplicate]
- c++ compile error: ISO C++ forbids comparison between pointer and integer
- error: redefinition of class
- C++ Error: No match for ‘operator=’
- undefined reference to WinMain@16 (codeblocks)
- 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?
- Why am I getting “undefined reference to main”
- 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++
- C++ undefined reference to WinMain@16 (Code::Blocks)
- Call to non-static member function without an object argument compiler error
- Error : aggregate ‘first one’ has incomplete type and cannot be defined
- 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
- template argument 1 is invalid (Code::Blocks Win Vista) – i don’t use templates
- 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]
- How to implement 2D vector array?
- What is the difference between g++ and gcc?
- What is the best way to use a HashMap in C++?
- What is the difference between float and double?
- How do I find the length of an array?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- lvalue required as left operand of assignment error when using C++
- How to concatenate two strings in C++?
- ‘g++’ is not recognized as an internal or external command, operable program or batch file
- Read file line by line using ifstream in C++
- Virtual/pure virtual explained
- Officially, what is typename for?
- Is there a maxheap in the C++ standard library?
- How do I iterate over the words of a string?
- How to declare a global variable in C++
- C++ Vector of pointers
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- How to iterate through a list of objects in C++?
- How to find memory leak in a C++ code/project?
- Is there a function to copy an array in C/C++?
- C++ error: no matching constructor for initialization of
- C error: Expected expression before int
- Why use string::iterator rather than index?
- Sleep function in C++
- Getting error “a nonstatic member reference must be relative to a specific object” while both member are in the same class
- Division in C++
- How to iterate over a vector?
- What are the differences between struct and class in C++?
- What is ‘\0’ in C++?
- Generate random float between two floats
- How do I fix “Undefined variable” error in PHP?
- Read data from a file into an array – C++
- Unknown override specifier, missing type specifier
- error: overloaded ‘operator<<' must be a binary operator (has 3 parameters)
- Process returned -1073741571 (0xC00000FD) on my c++ code
- Implementation of Vector in C++
- C++ Why Is There “Unknown Type” When Class Header is Included?
- Invalid conversion from “const char*” to “char” error [duplicate]
- Initializing a static std::map
in C++ - Cannot open Windows.h in Microsoft Visual Studio
- Nested For – Loops to create multiplication table C++
- The system cannot find the file specified. in Visual Studio
- bit vectors in c++
- to_string not declared in scope
- C++ Initializing a Global Array
- GCC -fPIC option
- initialize a vector to zeros C++/C++11
- When to use “new” and when not to, in C++?
- “vector” was not declared in this scope
- function does not take 1 arguments c++
- overloaded function with no contextual type information
- How exactly do lookup tables work and how to implement them?
- Vector declaration “expected parameter declarator”
- C++ Destructors with Vectors, Pointers,
- error C2065: ‘cout’ : undeclared identifier
- How to get the MD5 hash of a file in C++?
- C++ Error: Expected a type specifier
- Where to declare/define class scope constants in C++?
- “Incomplete type not allowed ” when creating std::ofstream objects
- ‘&’ : illegal operation on bound member function expression [duplicate]
- Multiple definitions of “Main”