#304

by asd

Submitted 1 year 3 months ago
Mon May 10 19:12:45 CST 2021
Judger: judger1
Dataset Version: v1

0 ms / 0 KB
Final 0
Problem: lss4.dandelion
Language: GNU C++ 11


#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int main(){
	string n;
	while(cin>>n){
	    if(n.size()>=2){
	        n=n[n.size()-2]+n[n.size()-1]
	    }
		if(n=="11" || n=="12" || n=="13" || n=="14"){
			cout<<n<<"th"<<endl;
			continue;
		}
		char c=n.back();
		if(c=='1'){
			cout<<n<<"st"<<endl;
		}else if(c=='2'){
			cout<<n<<"nd"<<endl;
		}else if(c=='3'){
			cout<<n<<"rd"<<endl;
		}else{
			cout<<n<<"th"<<endl;
		}
	}	
}
Compilation Error:
Main.cpp: In function ‘int main()’:
Main.cpp:44:6: error: expected ‘;’ before ‘}’ token
      }
      ^