• 输入一个年输出其天干地支纪年法的表达式


    #include <iostream>
    #include <cmath>
    using namespace std;
    
    char *day_name1(int x)
    {
    	static char *name[20]={"Gui","Jia", "Yi", "Bing", "Ding", "Wu", "Ji", "Geng", "Xin", "Ren", "Gui"};
    	return (name[x]);
    }
    char *day_name2(int y)
    {
    	static char *name[20]={"Hai","Zi", "Chou", "Yin", "Mao", "Chen", "Si", "Wu", "Wei", "Shen", "You", "Xu", "Hai"};
    	return (name[y]);
    }
    int main()
    {
    	int m;
    	cin>>m;
    	while(m--)
        {
            int year,t,d;
    		char *day_name1(int x);
    		char *day_name2(int y);
            cin>>year;
            t=(year-3)%10;
            d=(year-3)%12;
    		cout<<day_name1(t)<<day_name2(d)<<endl;
    	}
        return 0;
    }
    

    请dalao不吝赐教。
  • 相关阅读:
    iBatis,第二次亲密接触
    微斯人,吾谁与归
    一个月了
    生命在于运动
    眼皮跳了好几天
    往返
    中病毒,学习批处理

    爱如潮水
    今天夏至
  • 原文地址:https://www.cnblogs.com/liesun/p/7350346.html
Copyright © 2020-2023  润新知