You must exit the loop somewhere.
if(number < 0)
break;
Alternatively you can do this (which would be better in this case):
number = 0;
while(number >= 0)
{
....
}
More Related Contents:
- swap string a in place to string b in C++ [closed]
- Can’t use function in inheritance using template [closed]
- What is move semantics?
- What’s the best free C++ profiler for Windows? [closed]
- Is TCHAR still relevant?
- Undefined Symbol ___gxx_personality_v0 on link
- Using kbhit() and getch() on Linux
- C++ Virtual template method
- Are inner classes in C++ automatically friends?
- MinGW linker error: winsock
- std::bind a bound function
- Detect if program is running with full administrator rights
- Difference between and ?
- Deprecated conversion from string literal to ‘char*’
- Is the C++ std::set thread-safe?
- How to convert UTF-8 std::string to UTF-16 std::wstring?
- Why does Windows 10 start extra threads in my program?
- What expressions yield a reference type when decltype is applied to them?
- How to check for the type of a template parameter?
- Fastest way to get a positive modulo in C/C++
- Why is the STL so heavily based on templates instead of inheritance?
- Is boost shared_ptr thread safe?
- Chaining iterators for C++
- Does new line character also flush the buffer?
- Is it legal/well-defined C++ to call a non-static method that doesn’t access members through a null pointer?
- Why does sqrt() work fine on an int variable if it is not defined for an int?
- How much overhead is there when creating a thread?
- Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++?
- Cmake link library target link error
- What C++ pitfalls should I avoid? [closed]