Hello, I am submitting a C programming assignment for my class this weekend. Below is the finished assignment. I have tried to run this program but have gotten an error stating this "parse error before 'char' / 'token' undeclared (first use in this function) and (eahc undeclared identifier is reported only once for each function it appears in.) My question too who ever can help me is how can I make this program run properly as I found it on Chegg.
#include #include #include struct date { int month; int day; int year; }; // - function calc_date_number: which takes a date as an argument and returns a number // representing the date entered. int calc_date_number(struct date D) { //N=1461 x f(year,month) / 4 + 153 x g(month) / 5 + day int year_f = D.year; int month_f = D.month + 1; if (D.month <= 2) { year_f = D.year - 1; month_f = D.month + 13; } return 1461 * year_f / 4 + 153 * month_f / 5 + D.day; } // - function calc_day_number: which takes as a parameter the number calculated in // calc_date_number, and returns the number (0 - 6) representing the day of the week // (Sunday - Saturday). int calc_day_number(int N) { return (N - 621049) % 7; } // - function display_day_of_week: which takes as a parameter the N from the prior // function. You must then take this numeric representation of the day of the week, and use // it as an index into a character string array, to get the English representation of the day // of the week. void display_day_of_week(int N) { char* days[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; printf("falls on %s", days[N]); } int main() { char datestr[10]; char local[10]; struct date DATE; printf("The program will give the day of the week for any date from 1/1/1900"); while (1) { printf(" Enter date (mm/dd/yyyy): "); scanf("%s", datestr); strcpy(local,datestr); char* token = strtok(datestr, "/"); DATE.month = atoi(token); token = strtok(NULL, "/"); DATE.day = atoi(token); token = strtok(NULL, "/"); DATE.year = atoi(token); if(DATE.year < 1900) { printf(" Invalid year. Please re-enter date."); } else { if (DATE.month < 1 || DATE.month > 12) { printf(" Invalid month. Please re-enter date."); } else { if(DATE.day < 1 || DATE.day > 31) { printf(" Invalid day. Please re-enter date."); } else break; } } } printf(" %s ",local); display_day_of_week(calc_day_number(calc_date_number(DATE))); return 0; }