Can't get my user input to print.

For some reason it runs just fine until I get to the print function where it prints the everything but the input from the cin I did. It needs to look like this.
- - - - - - - - - - - - - - PATIENT INFORMATION - - - - - - - - - - - - - - - -
Medical Record No.: XXXXXXXXX  Patient’s Medical Record No
Patient’s Name: XX…XX X XX…XX  Patient YANOVICH
Address: XX...XX  Patient’s Street Address Line1
XX...XX  Patient’s Street Address Line2
XX...X, XX XXXXX-XXXX  Patient’s City, State Zip5-Zip4
(XXX)XXX-XXXX  Patient’s Phone Number
But this doesn't take the information from cout << "Enter the patient's medical record number: ";cin >> patientMedicalRecordNo;
cin.ignore(); and down and just spits out this.
- - - - - - - - - - - - - - PATIENT INFORMATION - - - - - - - - - - - - - - - -
Medical Record No.:
Patient's Name:
Address:

With no values added to them. Any help would be appreciated in regards to what is causing this.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include <iostream>
#include "PTIns.h"
#include "PTDemo.h"
#include "PTBill.h"
#include <iomanip>

// free function for banner
void banner();
// free function for Health Insurance Codes
void pICodes();

int main( )
{
string patientMedicalRecordNo; // patients medical record number
char patientInsuranceCode; // patient's health insurance code
string policyNo; // patient's policy number
string groupNo; // patient's group number
string patientFirstName; // patient's first name
char patientMiddleInitial; // patient's middle initial
string patientLastName; // patient's last name
string patientStreetAddress1; // patient's address part 1
string patientStreetAddress2; // patient's address part 2
string patientCity; // patient's city
string patientState; // patient's state
string patientZip5; // patient's 5 digit zip code
string patientZip4; // patient's 4 digit zip code
string patientHomeAreaCode; // patients home area code
string patientHomePhoneNo; // patient's home phone number
char patientGender; // patient's gender
int patientDateOfBirth; // patient's date of birth
string patientDiagnosisCode; // patient diagnosis code
bool patientMonthlyPaymentStatus; // patient monthly payment status
char patientVariable; //
double patientMonthlyPaymentAmt; // patient monthly payment amount
double patientCharge; // charge to patient's account
double patientBalance;

PatientDemographicInformation yanovich_demo(patientMedicalRecordNo, patientFirstName , patientMiddleInitial,
patientLastName, patientStreetAddress1,patientStreetAddress2, patientCity,
patientState, patientZip5, patientZip4, patientHomeAreaCode, patientHomePhoneNo,
patientGender, patientDateOfBirth);

PatientInsuranceInformation yanovich_insurance(patientMedicalRecordNo, patientInsuranceCode, policyNo, groupNo);

PatientBillingInformation yanovich_billing(patientMedicalRecordNo, patientDiagnosisCode, patientMonthlyPaymentStatus, patientMonthlyPaymentAmt, patientCharge, patientBalance);



cout << "Enter the patient's medical record number: ";
cin  >> patientMedicalRecordNo;
cin.ignore();

cout << "Enter the patient's first name: ";
cin  >> patientFirstName;
cin.ignore();

cout << "Enter the patient's middle initial: ";
cin  >> patientMiddleInitial;
cin.ignore();

cout << "Enter the patient's last name: ";
cin  >> patientLastName;
cin.ignore();

cout << "Enter the patient's street address (line 1): ";
getline(cin, patientStreetAddress1);


cout << "Enter the patient's street address (line 2): ";
getline(cin, patientStreetAddress2);


cout << "Enter the patient's city: ";
getline(cin, patientCity);


cout << "Enter the patient's state: ";
getline(cin, patientState);


cout << "Enter the patient's five digit zip code: ";
getline(cin, patientZip5);


cout << "Enter the patient's four digit zip code: ";
getline(cin, patientZip4);


cout << "Enter the patient's home area code: ";
getline(cin, patientHomeAreaCode);


cout << "Enter the patient's home phone number: ";
getline(cin, patientHomePhoneNo);


cout << "Enter the patient's gender (M = Male, F = Female): ";
cin  >> patientGender;
cin.ignore();

cout << "Enter the patient's date of birth (format MMDDYYYY): ";
cin  >> patientDateOfBirth;
cin.ignore();

pICodes();

cout << "Enter the patient's health insurance code: ";
cin  >> patientInsuranceCode;
cin.ignore();

cout << "Enter the patient's policy number: ";
cin  >> policyNo;
cin.ignore();

cout << "Enter the patient's group number: ";
cin  >> groupNo;
cin.ignore();

cout << "Enter the patient's diagnosis code: ";
cin  >> patientDiagnosisCode;
cin.ignore();

cout << "Enter the patient's monthly payment status (Y = Monthly Plan, N = No Monthly Plan): ";
cin  >> patientVariable;
cin.ignore();

if(patientVariable = 'y' || patientVariable != 'Y')
    {
    patientMonthlyPaymentStatus == true;

    cout << "Enter monthly payment amount: ";
    cin  >> patientMonthlyPaymentAmt;
    cin.ignore();
    
    cout << "Enter the patient's charge: $";
    cin  >> patientCharge;
    cin.ignore();
    }
else
    {
    patientMonthlyPaymentStatus == false;
    cout << endl;
    
    cout << "Enter the patient's charge: $";
    cin  >> patientCharge;
    cin.ignore();
}

cout << endl;
cout << endl;

banner();

cout << endl << endl;

yanovich_demo.printPatientDemographicInformation( );

cout << endl << endl ;

yanovich_insurance.printPatientInsuranceInformation( );

cout << endl << endl;

yanovich_billing.printPatientBillingInformation( );

return 0;

}
// free function for banner
void banner()
{
    cout << "********************************************************************"
         << endl
         << "********************************************************************"
         << endl
         << "*                                                                  *"
         << endl
         << "*                    YANOVICH’S  MEDICAL CENTER                   *"
         << endl
         << "*                     Building #7,  Room #701B                     *"
         << endl
         << "*                    1333 South Prospect Street                    *"
         << endl
         << "*                     Nanticoke, PA 18634-3899                     *"
         << endl
         << "*                           (570)740-0586                          *"
         << endl
         << "*                                                                  *"
         << endl
         << "********************************************************************"
         << endl
         << "********************************************************************"
         << endl;
}

// free function for Health Insurance Codes
void pICodes()
{
cout << "Health Insurance Codes:" << endl
<< " 1 - Blue Cross" << endl
<< " 2 - Medicare" << endl
<< " 3 - Medical Assistance" << endl
<< " 4 - Other " << endl; 
}
It would seem that you create two objects of the class...

1
2
3
PatientInsuranceInformation yanovich_insurance(patientMedicalRecordNo, patientInsuranceCode, policyNo, groupNo);

PatientBillingInformation yanovich_billing(patientMedicalRecordNo, patientDiagnosisCode, patientMonthlyPaymentStatus, patientMonthlyPaymentAmt, patientCharge, patientBalance);


which I assume sets information for them. But you declare these objects FIRST before the user will input anything to these variables. In actual, you are just passing along nothing into the objects because the user hasn't entered anything at all yet.

I would say the fix to this is a simple reordering of your code.
Last edited on
Thank you my man I can't believe I made such a simple error and couldn't figure out so really thank you.
Topic archived. No new replies allowed.