I want to print suffix such that st,nd,rd,th after integer....please help | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponse
+ 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