Weekly Appointments

Hello, I have a program where i need to figure out the dates for weekly appointments. It has the user input the first month and then the first date and then the total number of appointments and is then supposed to print out the list of the appointment dates but i can't get it to work at all. Please help. The code I have so far is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>

int main()
{
    int start_month;
    int start_day;
    int num_appointments;
    int days_of_appointments;
    int start_date;
    int days_in_month[] = {31,28,31,30,31,30,31,31,30,31,30,31};
    start_month = printf("Enter the month of the first appointment (Enter January as 1):\n");
    scanf("%d", &start_month);
    start_day = printf("Enter the day of the first appointment:\n");
    scanf("%d", &start_day);
    num_appointments = printf("Enter the number of appointments:\n");
    scanf("%d", &num_appointments);
    start_date = (start_month,"/",start_day);
    days_of_appointments = (start_date + 7 - days_in_month[]);
    printf("You will have appointments on:%d\n", days_of_appointments);

    return 0;

}

Last edited on
Are you required to use printf and scanf? If not, I'd use cout and cin instead.

Lines 11, 13, and 15 attempt to assign the value returned by printf into int variables. I'm sure this isn't what you mean to do. For each, you can get rid of the variable = (where "variable" is start_month, start_day, or num_appointments).

I'm not sure what days_of_appointments is supposed to be. Do you want it to contain the numerical value of each day on which there's an appointment? Or is it the total number of days on which there are appointments?

Lastly, what do you mean by not getting it to work? If that means it won't compile, the compiler errors should be decently helpful, or at least tell you which lines to focus on fixing. If it's simply not outputting what you want it to, what is the output?
It will compile and it asks for the correct things and allows me to enter digits but the last part where it is supposed to tell me when the appointments are is messed up. The output is: You will have appointments on: (numbers) which means it is a random file location in memory.

what I meant by days_of_appointments is i was trying to mathematically have the program figure out the days on which the appointment will be on. Like for it to add 7 days to the original date until you would reach the end of the given month and then it would go to the next month. like if it was march 28th the next appointment would be April 4th instead of it putting March 35th.

And yes I am required to put printf and scanf
The whole output is supposed to look something like this:
Enter the month of the appointment: 3
Enter the day of the appointment: 28
Enter number of appointments: 3
You have appointments on:
3/28
4/4
4/11
Topic archived. No new replies allowed.