current position:Home>About the problems of C language 2022 calendar event recording system! (development tool eclipse)

About the problems of C language 2022 calendar event recording system! (development tool eclipse)

2022-02-02 13:23:20 CSDN Q & A

The title design is shown in the figure

img

Step one has been completed , The used is eclipse,C Language .
At present, the most stupid way to modify the calendar . My idea is to store the calendar as an array , According to the title requirements , Divide each cell into three small cells , namely _1_ , 2 , 10_ , 31_ wait , The space after is used to store whether it is "+".

#include"Calendar.h"int main(){    setbuf(stdout,NULL);    Welcome();    OpChoice();    return 0;}/* Here are Calendar.h*/#ifndef CALENDAR_H_#define CALENDAR_H_#include<math.h>#include<stdlib.h>#include<stdio.h>#include<string.h>void BackToMenu();void DisplayMonthCalendar(){    //system("cls");    int month;    printf("Please input the month(Enter '0' to exit): ");    scanf("%d",&month);    while((month>12)||(month<0))    {        printf("The month is incorrect.Please input the month again: ");        scanf("%d",&month);    }    if (month==0)    {        BackToMenu();        return;    }    //system("cls");    switch(month)    {        case 1:printf(" January \n");    break;        case 2:printf(" February \n");    break;        case 3:printf(" March \n");    break;        case 4:printf(" April \n");    break;        case 5:printf(" May \n");    break;        case 6:printf(" June \n");    break;        case 7:printf(" July \n");    break;        case 8:printf(" August \n");    break;        case 9:printf(" September \n");    break;        case 10:printf(" October \n");    break;        case 11:printf(" November \n");    break;        case 12:printf(" December \n");    break;        default:  break;    }    char week[7][3]={
   
   
   
   "Su","Mo","Tu","We","Th","Fr","Sa"};    for (int i=0;i<7;i++)    {        printf("%s ",week[i]);    }    printf("\n");    char m1[110][4]={
   
   
   
   " "," "," "," "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    char m2[150][4]={
   
   
   
   " "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 "};    char m3[150][4]={
   
   
   
   " "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    char m4[150][4]={
   
   
   
   " "," "," "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 "};    char m5[150][4]={
   
   
   
   " 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    char m6[150][4]={
   
   
   
   " "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 "};    char m7[150][4]={
   
   
   
   " "," "," "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    char m8[150][4]={
   
   
   
   " "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    char m9[150][4]={
   
   
   
   " "," "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 "};    char m10[150][4]={
   
   
   
   " "," "," "," "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    char m11[150][4]={
   
   
   
   " "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 "};    char m12[150][4]={
   
   
   
   " "," "," "," "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 "," 7 "," 8 "," 9 ","10 ","11 ","12 ","13 ","14 ","15 ","16 ","17 ","18 ","19 ","20 ","21 ","22 ","23 ","24 ","25 ","26 ","27 ","28 ","29 ","30 ","31 "};    switch(month)    {        case 1:        {            for (int i=0;i<37;i++)            {                printf("%s",m1[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 2:        {            for (int i=0;i<150;i++)            {                printf("%s",m2[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 3:        {            for (int i=0;i<150;i++)            {                printf("%s",m3[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 4:        {            for (int i=0;i<150;i++)            {                printf("%s",m4[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 5:        {            for (int i=0;i<150;i++)            {                printf("%s",m5[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 6:        {            for (int i=0;i<150;i++)            {                printf("%s",m6[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 7:        {            for (int i=0;i<150;i++)            {                printf("%s",m7[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 8:        {            for (int i=0;i<150;i++)            {                printf("%s",m8[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 9:        {            for (int i=0;i<150;i++)            {                printf("%s",m9[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 10:        {            for (int i=0;i<150;i++)            {                printf("%s",m10[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 11:        {            for (int i=0;i<150;i++)            {                printf("%s",m11[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        case 12:        {            for (int i=0;i<150;i++)            {                printf("%s",m12[i]);                if ((i+1)%7==0)                    printf("\n");            }            break;        }        default:    break;    }    month=0;    printf("\nPlease Enter '0' to return: ");    scanf("%d",&month);    while (month!=0)    {        printf("The number is incorrect.Please Enter '0' to return: ");        scanf("%d",&month);    }    if (month==0)    {        BackToMenu();        return;    }}void AddEvents(){}void DeleteEvents(){}void InquireEvents(){}void Quit(){    exit(0);}void Welcome(){    printf("1.Display month calendar\n\n");    printf("2.Add events\n\n");    printf("3.Delete events\n\n");    printf("4.Inquire events\n\n");    printf("5.Quit\n\n");    //printf("Please enter the choice number to select the operation: ");    //getchar();}void OpChoice()// Function selection operation function {    printf("Please enter the choice number to select the operation: ");    int OpNumber;    //OpNumber=0;    scanf("%d",&OpNumber);    switch(OpNumber)    {        case 1:            DisplayMonthCalendar();break;        case 2:            AddEvents();break;        case 3:            DeleteEvents();break;        case 4:            InquireEvents();break;        case 5:            Quit();break;    }}void BackToMenu(){    Welcome();    OpChoice();}#endif /* CALENDAR_H_ */

The current problem is that I can't modify my array calendar well when I can't use global variables , And storing events in .txt After that, the events of each day cannot be well classified , I don't know where txt The date in the file corresponds to the event , Cannot read this kind of relationship .
For help !

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021323187273.html

Random recommended