Maya Calendar

学会用字符数组来存。还有读取数据的细节。两个年对应的关系。

#include
<iostream> #include <cstring> #include <cstdio> #include <string.h> char Haab[20][10] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}; char Tzolkin[20][15] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; using namespace std; int main() { int n; while(cin>>n) { cout<<n<<endl; for(int i = 0 ; i <n;i++) { int numberOfDay,year,month; int total = 0; char NameOfDay[10]; cin>>numberOfDay; getchar(); getchar(); cin>>NameOfDay; cin>>year; for(int i = 0; i < 20;i++) { if(strcmp(Haab[i],NameOfDay) == 0) { month = i; } } total = month * 20 + 365*year + numberOfDay; cout<<total%13+1<<" "<<Tzolkin[total%20]<<" "<<total/260<<endl; } } return 0; }

转载于:https://www.cnblogs.com/T8023Y/p/3204914.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值