编写一个程序,确定生日聚会的计划制定日期

编写一个程序,确定生日聚会的计划制定日期。具体要求如下。
1.功能
⑴ 给出一个欢迎界面,用户按任意键继续。
⑵ 提示用户输入生日的日期、今天的日期,程序显示今天到下
次生日的间隔天数。
⑶ 提示用户是否需要确定生日聚会计划的制定日期,如果用户
选择否,则结束,进入结果显示界面;如果用户选择“是”,则进入生
日聚会计划制定日期的确定环节。
⑷ 在生日聚会计划制定日期的确定环节,显示生日日期、生日
距离今天的天数。提示用户输入需要提前多少天做计划,假设用户输
入的是提前 n 天。给出生日前 n 天的日期作为计划日期,如果这一天
是工作日,则提示用户,并改为最近的一个周六为计划日期。用户确
认后,进入结果显示界面。
⑸ 在结果显示界面,显示生日日期、生日距离今天的天数、距
离生日前 n 天的日期、预计准备做计划的计划日期(如有)。询问用
户是否需要(重新)确定计划日期,如果用户选择“是”,进入生日聚
会计划日期制定环节,否则,进入结束界面。
⑹ 结束界面,提示用户计划日期,用户按任意键结束。

回答不易 求求您采纳点赞哦 感激不尽

这是一个可以实现您描述的功能的 C 语言代码的示例,你可以参考一下下:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define MIN_YEAR 2000
#define MAX_YEAR 2100

struct Date {
  int day;
  int month;
  int year;
};

void getDate(struct Date *date) {
  printf("Enter date (dd/mm/yyyy): ");
  scanf("%d/%d/%d", &date->day, &date->month, &date->year);
}

int daysBetweenDates(struct Date from, struct Date to) {
  time_t fromTime = mktime(&(struct tm){
    .tm_mday = from.day,
    .tm_mon = from.month - 1,
    .tm_year = from.year - 1900
  });
  time_t toTime = mktime(&(struct tm){
    .tm_mday = to.day,
    .tm_mon = to.month - 1,
    .tm_year = to.year - 1900
  });
  return difftime(toTime, fromTime) / (60 * 60 * 24);
}

void showPlanningDate(struct Date birthday, int planningDaysBefore) {
  struct tm *planningDate = localtime(&(time_t){
    .tm_mday = birthday.day - planningDaysBefore,
    .tm_mon = birthday.month - 1,
    .tm_year = birthday.year - 1900
  });

  while (planningDate->tm_wday != 6) {
    planningDate->tm_mday--;
    mktime(planningDate);
  }

  printf("Planning date: %02d/%02d/%d\n",
    planningDate->tm_mday, planningDate->tm_mon + 1, planningDate->tm_year + 1900
  );
}

int main(void) {
  printf("Welcome to birthday party planning program\n");
  printf("Press any key to continue...\n");
  getchar();

  struct Date birthday, today;
  getDate(&birthday);
  getDate(&today);

  int days = daysBetweenDates(today, birthday);
  printf("There are %d days until the birthday\n", days);

  char answer;
  printf("Do you want to plan the birthday party? (y/n): ");
  scanf(" %c", &answer);

  if (answer == 'y') {
    int planningDaysBefore;
    printf("Enter the number of days before the birthday to plan: ");
    scanf("%d", &planningDaysBefore);

    showPlanningDate(birthday, planningDaysBefore);
    printf("Do you want to re-plan the date? (y/n): ");
    scanf(" %c", &answer);

    while (answer == 'y') {
      printf("Enter the number of days before the birthday to plan: ");
      scanf("%d", &planningDaysBefore);

      showPlanningDate(birthday, planningDaysBefore);
      printf("Do you want to re-plan the date? (y/n): ");
      scanf(" %c", &answer);
    }
  }

  printf("Birthday date: %02d/%02d/%d\n", birthday.day, birthday.month, birthday.year);
  printf("Today's date: %02d/%02d/%d\n", today.day, today.month, today.year);
  printf("There are %d days until the birthday\n", days);

  printf("The end. Press any key to exit...\n");
  getchar();

  return 0;
}