C++ Project on Doctor Appointment
Features
- This project manages doctor appointment
- The record is maintained even if application is closed
- Compiled on Dev C++/ g++
Source Code
/*
Author: https://www.cppbuzz.com
Date: 20th Jan 2018
For more projects please visit : https://www.cppbuzz.com
*/
#include
#include
#include
#include
using namespace std;
int bookAppointment()
{
system("cls");
cout<<"\n ----- Book Your Appointment ---- \n";
cout<<"\n ----- Availbale slots ---- \n";
//check if record already exist..
ifstream read;
read.open("appointment.dat");
int hoursbook = 8;
int arr[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
int recordFound =0;
if(read)
{
string line;
char key = 'A';
int i = 9;
while(getline(read, line)) {
char temp = line[0];
int index = (temp - 65);
arr[index]=1;
recordFound = 1;
}
if(recordFound == 1)
{
cout<<"\n Appointment Summary by hours:";
char key = 'A';
int hours = 9;
for(int i = 0; i<=12; i++)
{
if(i == 0){
if(arr[i] == 0)
cout<<"\n "< 0"< 0"<"<"< 0"< "<>choice;
if( !(choice >= 'A' && choice <='Z'))
{
cout<"\n Error : Invalid Selection";
cout<<"\n Please selction correct value from menu A- Z";
cout<"\n Press any key to continue";
getchar();getchar();
system("cls");
bookAppointment();
}
int index = (choice-65 );
int isBooked = 1;
if(arr[index] == 0)
isBooked = 0;
if(isBooked ==1)
{
cout<<"\n Error : Appointment is already booked for this Hour";
cout<<"\n Please select different time !!";
cout<<"\n Press any key to continue!!";
getchar();getchar();
system("cls");
bookAppointment();
}
string name;
cout<<"\n Enter your first name:";
cin>>name;
ofstream out;
out.open("appointment.dat", ios::app);
if(out){
out<"<"< 0"< "<