This should do the trick:
monthOfQuarter = ((month - 1) % 3) + 1;
More Related Contents:
- How can I get out of the loop and continue the loop again?
- Cannot create a method in a class
- segmentation fault in an sorted linked list program for Homework [closed]
- Undefined behavior and sequence points
- Why aren’t variable-length arrays part of the C++ standard?
- Use of ‘const’ for function parameters
- Where are static variables stored in C and C++?
- Why is it wrong to use std::auto_ptr with standard containers?
- Rules for C++ string literals escape character
- Why does rand() yield the same sequence of numbers on every run?
- scope resolution operator without a scope
- Use OpenSSL RSA key with .Net
- Same random numbers every loop iteration
- How do I print the elements of a C++ vector in GDB?
- Getting the actual length of a UTF-8 encoded std::string?
- gcc/g++: “No such file or directory”
- How to use clock() in C++
- C++ Filehandling: Difference between ios::app and ios::ate?
- What is the past-the-end iterator in STL C++?
- using class name in a class template without template parameters
- How to make reading from `std::cin` timeout after a particular amount of time
- What’s the fastest way to pack 32 0/1 values into the bits of a single 32-bit variable?
- How to convert a command-line argument to int?
- Advantage of using trailing return type in C++11 functions
- Undefined reference to static variable [duplicate]
- Why is a default constructor required when storing in a map?
- Best Tips for documenting code using doxygen? [closed]
- How does “using std::swap” enable ADL?
- What should the ‘pop()’ method return when the stack is empty? [duplicate]
- Why calling main() is not allowed in C++