Advertisement
Rimifawfaw

tell me centure

Nov 4th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. bool unique(string str)
  4. {
  5. sort(str.begin(), str.end());
  6. for (int i = 0; i < str.length(); i++)
  7. {
  8. if (str[i] == str[i + 1])
  9. {
  10. return false;
  11. }
  12. }
  13. return true;
  14. }
  15. int main()
  16. {
  17. long long int i,j,k,m=0,l,n,o=0,p=0,x;
  18. map<char ,int> ma,mb;
  19. map<char ,int> ::iterator im;
  20. string s,c;
  21. cin>>x;
  22. for(i=1;i<=x;i++)
  23. {m=0;
  24. cin>>n;
  25. if(n%100==0)
  26. {
  27. m = n/100;
  28. k=m;
  29. k%=10;
  30. if(k==1&&(m>20 || m<10))
  31. {
  32. cout<<"Case #"<<i<<": "<<m<<"st century!"<<endl;
  33. }
  34. else if(k==2&&(m>20 || m<10))
  35. {
  36. cout<<"Case #"<<i<<": "<<m<<"nd century!"<<endl;
  37. }
  38. else if(k==3&&(m>20 || m<10))
  39. {
  40. cout<<"Case #"<<i<<": "<<m<<"rd century!"<<endl;
  41. }
  42. else
  43. {
  44. cout<<"Case #"<<i<<": "<<m<<"th century!"<<endl;
  45.  
  46. }
  47. }
  48. if(n%100 != 0)
  49. {
  50. m = n/100;
  51. k=m;
  52. k%=10;
  53. if(k+1==1&&(m>20 || m<10))
  54. {
  55. cout<<"Case #"<<i<<": "<<m+1<<"st century!"<<endl;
  56. }
  57. else if(k+1==2&&(m>20 || m<10))
  58. {
  59. cout<<"Case #"<<i<<": "<<m+1<<"nd century!"<<endl;
  60. }
  61. else if(k+1==3&&(m>20 || m<10))
  62. {
  63. cout<<"Case #"<<i<<": "<<m+1<<"rd century!"<<endl;
  64. }
  65. else
  66. {
  67. cout<<"Case #"<<i<<": "<<m+1<<"th century!"<<endl;
  68.  
  69. }
  70. }
  71. }
  72.  
  73.  
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement