/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
//using namespace std;
std::string show_ordinal(int);
int main()
{
std::cout << show_ordinal(2) << std::endl;
return 0;
}
std::string show_ordinal(int x)
{
switch(x % 10)
{
case 1:
if(x % 10 == 1) {
std::cout << x << "st";
}
break;
case 2:
if(x % 10 == 2) {
std::cout << x << "nd";
}
break;
case 3:
if(x % 10 == 3) {
std::cout << x << "rd";
}
break;
case 4:
if(x % 10 != 1 || x % 10 != 2 || x % 10 != 3) {
std::cout << x << "th";
}
break;
}
}