Help with coding

I wrote all my program, but my output is not how it is suppose to be. its suppose to be like this:
#290764
PATEL, ILAXI, DO
ADULT/INTERNAL MEDICINE
KISHHEALTH PHYSICIANS GROUP - DEKALB
1850 GATEWAY DR
SYCAMORE, IL 60178
(815) 758-8671

Only half prints. also for name I dont know how to do these instructions " The name will store a concatenated version of the provider's last name, first name, middle initial (if present), and title".

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
  #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
 
using std::cout;
using std::endl;
using std::ifstream;
 
class Provider
{
private:
char number[7];
char specialty[41];
char name[41];
char faddress[41];
char saddress[31];
char city[21];
char state[3];
char zip[6];
char phone[15];
 
public:
Provider();
Provider(const char*,const char*,const char*,const char*,const char*,const char*,const char*,const char*,const char*);
void setNumber(const char*);
void setSpecialty(const char*);
void setName(const char*);
void setFAddress(const char*);
void setSAddress(const char*);
void setCity(const char*);
void setState(const char*);
void setZip(const char*);
void setPhone(const char*);
 
void print();
};
 
int buildArray(Provider[]);
 
int main()
{
Provider providers[20];
int count,i;
 
count= buildArray(providers);
 
for(i=0;i<count;i++)
providers[i].print();
 
return 0;
}
 
int buildArray(Provider providers[])
{
char number[7];
char specialty[41];
char name[41];
char faddress[41];
char saddress[31];
char city[21];
char state[3];
char zip[6];
char phone[15];
int count = 0;
 
ifstream inFile;
 
inFile.open("providers.csv");
if(!inFile)
{
cout<<"Error:unable to open\n";
exit(1);
}
 
while(inFile.getline(number, 7, ','))
{
inFile.getline(specialty, 41, ','),
inFile.getline(name, 41,','),
inFile.getline(faddress, 41, ','),
inFile.getline(saddress, 31, ','),
inFile.getline(city, 21, ','),
inFile.getline(state, 3, ','),
inFile.getline(zip, 6, ','),
inFile.getline(phone, 15);
Provider newProvider(number, specialty, name, faddress, saddress, city, state, zip, phone);
providers[count]= newProvider;
 
count++;
}
 
inFile.close();
 
return count;
}
 
Provider::Provider()
{
strcpy(number, "");
strcpy(specialty, "");
strcpy(name, "");
strcpy(faddress, "");
strcpy(saddress, "");
strcpy(city, "");
strcpy(state, "");
strcpy(zip, "");
strcpy(phone, "");
}
 
Provider::Provider(const char* newNumber,const char* newSpecialty,const char* newName,const char* newFAddress,const char* newSAddress,const char* newCity,const char* newState,const char* newZip,const char* newPhone)
{
strcpy(number, newNumber);
strcpy(specialty, newSpecialty);
strcpy(name, newName);
strcpy(faddress, newFAddress);
strcpy(saddress, newSAddress);
strcpy(city, newCity);
strcpy(state, newState);
strcpy(zip, newZip);
strcpy(phone, newPhone);
}
 
void Provider::print()
{
cout<< number << endl
    << specialty << endl
    << name << endl
    << faddress << endl
    << saddress << endl
    << city << endl
    << state << endl
    << zip << endl
    << phone<< endl << endl;
}
 
void Provider::setNumber(const char* newNumber)
{
strcpy(number,newNumber);
}
 
void Provider::setSpecialty(const char* newSpecialty)
{
strcpy(specialty,newSpecialty);
}
 
void Provider::setName(const char* newName)
{
strcpy(name,newName);
}
 
void Provider::setFAddress(const char* newFAddress)
{
strcpy(faddress,newFAddress);
}
 
void Provider::setSAddress(const char* newSAddress)
{
strcpy(saddress,newSAddress);
}
 
void Provider::setCity(const char* newCity)
{
strcpy(city,newCity);
}
 
void Provider::setState(const char* newState)
{
strcpy(state,newState);
}
 
void Provider::setZip(const char* newZip)
{
strcpy(zip,newZip);
}
 
void Provider::setPhone(const char* newPhone)
{
strcpy(phone,newPhone);
}
Topic archived. No new replies allowed.