Guest wrote:I doubt your cases are what you intend.The are not separate cases, they are the bitwise ORing of the values.
- Code: Select all
#include <iostream>
int main()
{
std::cout << ((1) | (21) | (31)) << std::endl;
std::cout << ((2) | (22)) << std::endl;
std::cout << ((3) | (23)) << std::endl;
return 0;
}
/* my output
31
22
23
*/
I think what you meant is that my switch in suffix function is wrong, but it isn't , it is supposed to cout "st" when the number is 1, 21 or 31, so it would be 1st, 21st or 31st , same with the others, and when is none of them it couts "th" so 25th , 6th,...
