Professional Documents
Culture Documents
h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define WEEK_CELL_FIRST_COL_WIDTH 10
#define WEEK_CELL_OTHER_COL_WIDTH 20
struct Task {
int num;
char title[MAX_LENGTH_TITLE + 1];
char description[MAX_LENGTH_DESCRIPTION + 1];
char time[MAX_LENGTH_TIME + 1];
enum Status status;
};
struct ngay {
char DDD[4];
int dd;
int mo;
int yyyy;
};
typedef struct ngay day;
int printWeekTime(struct Task* array_tasks, int no_tasks, char* date) {
day x;
sscanf(date, "%3s/%02d/%02d/%04d", x.DDD, &x.dd, &x.mo, &x.yyyy);
printf("| |");
while (e <= no_tasks) {
sscanf((array_tasks + e)->time, "%02d:00|%d/%*d/%*d-%02d:00|%*d/%*d/%*d", &time1, &dayx, &time2);
if (time1 == i) {
if (dayx = mon) {
printf("| |");
printf("|%s|", (array_tasks + e)->title);
}
}
if (time1 != i) {
printf("| |");
for (int i = 1; i <= 7; ++i) {
printf("| |");
}
printf("\n");
printf("| |");
for (int i = 1; i <= 7; ++i) {
printf("| |");
}
printf("\n");
break;
}
e++;
}
g++;
}
return 0;
}
int main() {
struct Task array_tasks[5] = {
{1, "Course Intro to Programming", "Room 701-H6 - orange", "00:00|16/10/2023-09:00|16/10/2023",
IN_PROGRESS},
{2, "Meeting Project Apple", "Room 701-H6 - apple", "01:00|16/16/2023-09:00|17/10/2023", IN_PROGRESS},
{3, "Meeting Project Banana", "Room 701-H6 - orange", "02:00|16/10/2023-08:00|19/10/2023", IN_PROGRESS},
{4, "Do an Tong hop - TTNT", "Room 701-H6 - orange", "03:00|16/10/2023-10:00|21/10/2023",
IN_PROGRESS},
{5, "Course Intro to Programming - apple", "Room 701-H6 - banana", "04:00|16/10/2023-12:00|01/10/2023",
DONE},
};
int no_tasks = 4;
char date[] = "MON/16/10/2023";
int code = printWeekTime(array_tasks, no_tasks, date);
printWeekTime(array_tasks, no_tasks, date);
if (code != -1) {
printf("Unsupported task at index: %d\n", code);
}
return 0;
}