2 Replies - 452 Views - Last Post: 04 December 2012 - 09:44 PM Rate Topic: -----

#1 lauren_hasloecher  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-December 12

Creating a weekly appointment schedule

Posted 04 December 2012 - 03:16 PM

I'm trying to figure out how to create a weekly appointment reminder program where it lists all the appointment dates in order. Right now I have it ask the user to input the first appointment month and then the day and then how many appointments there will be in total and then the program is supposed to print out the dates of each appointment but it isn't working at all. The code I have so far is this:
 
#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;

} 

Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Creating a weekly appointment schedule

#2 Adak  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 331
  • View blog
  • Posts: 1,168
  • Joined: 01-April 11

Re: Creating a weekly appointment schedule

Posted 04 December 2012 - 04:19 PM

I don't see how you're going to work with "days of appointments", when it's only one integer.

Ideally, you'd like to have each appointment as a struct, with struct members of date and time, and place, with a short description like "dentist" or "lunch with Carol".

Having only 1 int for a lot of separate variables makes the program unusable, imo.
Was This Post Helpful? 0
  • +
  • -

#3 lauren_hasloecher  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-December 12

Re: Creating a weekly appointment schedule

Posted 04 December 2012 - 09:44 PM

The appointments aren't being assigned to anything like that the program is to simply just say you have an appointment on these days. I went with days of appointments because I am trying to figure out how to write the program that once you put in the month and day of the appointment and then how many appointments you have it says you have appointments on these days. So if i say the first appointment is on March 28th and there are three appointments, the output would be:
You have appointments on:
3/28
4/4
4/11

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1