My application must let a nurse enter information for a number of patients about the patients' number
of repetitions for various otherwise ordinary activities.
The nurse gets a book in the format to enter the information.
Month Date Day Activity Repetitions
January 1 Monday brushed_teeth 9
January 1 Monday combed_hair 5
January 1 Monday stepped_up_bottom_step 20
January 1 Monday cleaned_basin 40
January 2 Tuesday brushed_teeth 10
I have no luck getting information stored and looped correctly.
#include <iostream>
#include <string>
using namespace std;
struct Patient
{
char f_name[20];
char l_name[20];
int pat_id;
char month[12];
int date;
char Day[15];
char activity[50];
int activ_count = 0;
int repetitions;
int roll;
}
patients[4];
int main()
{
string month = "" ;
string months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
int day_count = 0;
int day = 0;
// storing information
for (int i = 0; i <= 4; ++i) //starting at patient 1
{
patients[i].roll = i + 1;
cout << "Enter the patient information" << patients[i].roll << "," << endl;
cout << "Enter first name: ";
cin >> patients[i].f_name;
cout << "Enter last name: ";
cin >> patients[i].f_name;
cout << "Enter Patient ID: ";
cin >> patients[i].pat_id;
cout << "Enter the month for these entries: " << endl;
cin >> month;
if (months[0,2,4,6,7,9,11] == month) //for months with 31 days
{
while (day = 1 && day <= 31)
{
cout << "How much activities did they do today? ";
cin >> patients[i].activ_count;
if (day_count <= patients[i].activ_count )
{
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
day_count++;
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
day++;
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
cout << endl;
if (months[3, 5, 8, 10] == month) //months with 30 days
{
while (day = 1 && day <= 31)
{
cout << "How much activities did they do today? ";
cin >> patients[i].activ_count;
if (day_count <= patients[i].activ_count)
{
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
day_count++;
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
day++;
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
cout << endl;
if (months[1] == month)
{
while (day = 1 && day <= 31)
{
cout << "How much activities did they do today? ";
cin >> patients[i].activ_count;
if (day_count <= patients[i].activ_count)
{
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
day_count++;
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
day++;
cout << "Enter date: ";
cin >> patients[i].date;
cout << "Enter day : ";
cin >> patients[i].Day;
cout << "Enter activity: ";
cin >> patients[i].activity;
cout << "Enter repetitions: ";
cin >> patients[i].repetitions;
}
cout << endl;
}
cout << "Displaying Information: " << endl;
// Displaying information
for (int i = 0; i < 1; ++i)
{
cout << "\nPatient Name: " << i + 1 << endl;
cout << "Name: " << patients[i].f_name << endl;
cout << "ID: " << patients[i].pat_id << endl;
cout << "month: " << endl;
cout << "Activity: " << patients[i].activity << endl;
cout << "rep: " << patients[i].repetitions << endl;
cout << "date: " << patients[i].date << endl;
}
system("pause");
}