Use an if statement:
if (hours < max_hours) {
// Do stuff
}
else {
std::cout << "Invalid Hours";
}
More Related Contents:
- Char* combining [closed]
- character and array [closed]
- Something about C++ binary [closed]
- Error when reading txt file, can’t read txt file correctly
- How to create a generic object model for use in QML?
- Does “Undefined Behavior” really permit *anything* to happen? [duplicate]
- Comparing a variable to a range of values
- Is it better in C++ to pass by value or pass by reference-to-const?
- Can the arguments of main’s signature in C++ have the unsigned and const qualifiers? [duplicate]
- Most accurate way to do a combined multiply-and-divide operation in 64-bit?
- Measuring memory bandwidth from the dot product of two arrays
- How do I use unique_ptr for pimpl?
- What is std::decay and when it should be used?
- get absolute value without using abs function nor if statement
- Does “undefined behaviour” extend to compile-time?
- Preventing a MEX file from crashing in MATLAB
- Is there any case where a return of a RValue Reference (&&) is useful?
- C++ : Creating an array with a size entered by the user
- Who defines C operator precedence and associativity?
- What is Linux’s native GUI API?
- How to use the priority queue STL for objects?
- Align cout format as table’s columns
- pair pair as key of unordered_map issue
- When pass a variable to a function, why the function only gets a duplicate of the variable?
- Dependent name resolution & namespace std / Standard Library
- C++: Pointer to monomorphic version of virtual member function?
- How to determine if returned pointer is on the stack or heap
- What is the meaning of this star (*) symbol in C++? — Pointer to member
- Converting Between Local Times and GMT/UTC in C/C++
- What is C++ version of realloc(), to allocate the new buffer and copy the contents from the old one?