1. ## Appointment Book Problem

hi

i am learning c++ from home and have started a home project in which i am trying to write a program which will allow me to enter a days bookings in an appointment book. For the sake of simplicity i have decided that bookings will only run from 0900 to 1700 and that the output should hopefully be something like the format below:

15/03/02
9
10 booked
11
12
13 booked
14
15
16
17

i understand that i need to use an array to hold the time of day but how would I go about programming the code so that

1. the program will prompt for and accept the days date
2. initialise all the hours in the day to "free"
3. repeatedly prompt the user for an hour number
4. if an hour is free mark it as "booked" otherwise tell the user that it is "already booked"
5. display the day and its appointments.

thanks

2. you are asking for a lot....

*HINT: you should start it yourself and when you encounter a problem then you go about posting this very "single" problem or "function" on the board and people would be able to help you in greater detail....

matheo917

ps. don't approach programmig as a whole problem at a time, think of it as bunch of small tasks one-by-one...
try to right down all your specifications on paper, as well as trying to design a solution in plain "human" words, on paper too......and work from there

3. struct Date
{
int month;
int dDate;
int year;
};

struct appointment
{
int time;
bool booked;
};

struct Day
{
Date date;
appointment appointments[10];
};

struct Calendar
{
Day days[30];
}

4. ## Appointment Book Problem

When run, my program below allows me to book d first available hours starting from 0900. how can i revise the code so that i can pick which hour i want to book? eg i can pick and book 1400 if it is free, at the moment i can't as it asks me for duration of hours to be booked and it will read from 0900.

thanks

#include <iostream.h>
#include <string.h>
#include<conio.h>

struct book
{
char time[5];
bool status;
};

void makebook(book z[])
{
strcpy(z[0].time,"0900");
strcpy(z[1].time,"1000");
strcpy(z[2].time,"1100");
strcpy(z[3].time,"1200");
strcpy(z[4].time,"1300");
strcpy(z[5].time,"1400");
strcpy(z[6].time,"1500");
strcpy(z[7].time,"1600");
strcpy(z[8].time,"1700");

z[0].status=true;
z[1].status=true;
z[2].status=true;
z[3].status=true;
z[4].status=true;
z[5].status=true;
z[6].status=true;
z[7].status=true;
z[8].status=true;
}

void printbook(book z[])
{
for(int i=0;i<9;i++)
{
cout<<i+1<<" "<<z[i].time<<"\t";

if(z[i].status!=true)
cout<<"Booked"<<endl;
else
cout<<""<<endl;
}
}

void main ()
{
book ob[9];
makebook(ob);

printbook(ob);

char date[11];

cout<<"enter the date in mm/dd/yyyy format : ";
cin>>date;

{
cout<<"Enter number of hour to enter appointment : ";
int num;
cin>>num;

if(ob[num].status==false)
else
{
cout<<ob[num].time<<" booked now"<<endl;
ob[num].status=false;
}

cout<<"Enter another appointment ? (y/n) : ";
char temp;
cin>>temp;
if(temp=='n')