免费试用:最火的人工智能查询工具
     最强AI人工智能聊天工具
     对话机器人解答疑难问题
星外智问直连原始API接口(GPT-4o)
➡️未登录受限条数,请登陆使用完整服务>>>➡️
请输入您要问的问题:


查下百度  查下必应

以下是单个问题的回复:

问:编写一段c语言代码,显示一个万年历
GPT答: 7i24.cn
抱歉,作为AI语言模型,我无法生成图形界面的代码。但是,以下是一个简单的C语言程序,可以根据输入的年份和月份显示一个基本的万年历。

```
#include <stdio.h>

int main()
{
    int year, month, daysInMonth, startingDay;

    // 获取用户输入
    printf("请输入年份: ");
    scanf("%d", &year);

    printf("请输入月份 (1-12): ");
    scanf("%d", &month);

    // 计算该月有多少天
    if (month == 2)
        {
            if ((year % 4 == 0 && year % 100 !=0) || year %400 ==0)
                daysInMonth = 29;
            else
                daysInMonth =28;
        }
     else if (month ==4 || month==6 || month==9 || month==11)
         daysInMonth=30;
     else
         daysInMonth=31;

     // 计算该月第一天是星期几(0-6)
     int centuryCode = year /100; 
     int yearCode = year %100; 
     
     if(month <=2) 
         {  
             centuryCode--;  
             yearCode +=98;  
         }  

      int tempYearCode = (int)(yearCode + (yearCode/4));  
      startingDay =(int)(((tempYearCode + centuryCode/4 -2*centuryCode +26*(month+1)/10)%7)+7)%7;

      // 打印日历头部信息
      printf("\n\n");
      printf("       日历:%d 年 %d 月\n", year, month);
      printf("日 一 二 三 四 五 六\n");

      // 打印该月的日期
      int i;
      for (i=0; i<startingDay; i++)
          printf("   ");
      
      for (i=1; i<=daysInMonth; i++)
         {
             printf("%2d ",i);
             if ((i+startingDay)%7 ==0)
                 printf("\n");
         }

    return 0;
}
```
一星  二星  三星  四星  五星 

互联网非法外之地,请不要输入不良内容
 查下百度 查下必应 04-20 13:52:30



chatGPT中国版--星外智问--8v6.CN
当前运行网址:www.8v6.cn
客服微信:xwgdd_com APP下载 怎么问 识别真假GPT4 使用GPT赚钱 退出登陆