I want to print suffix such that st,nd,rd,th after integer....please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to print suffix such that st,nd,rd,th after integer....please help

11th Jun 2017, 2:11 AM
Bhuvanesh
Bhuvanesh - avatar
1 Answer
+ 1
Like this? int num = 2; cout << num << "nd"; You could use a switch case to do it for a number when you don't know what the number will be before hand. switch(num) { case 1: cout << num << "st"; ... }
11th Jun 2017, 2:17 AM
Jason Runkle
Jason Runkle - avatar