Have a question?
Message sent Close

CIS170C Programming Append Function Enabling User to Input Data DeVry University

0
0 reviews
  • Description
  • Full Document
Blur-Preview

DeVry University

CIS170C Programming Append Function Enabling User to Input Data DeVry University

switch (userEnter) {
case ‘A’:
writeData();
break;
case ‘S’:
readData();
break;
case ‘E’:
break;
}
} while (userEnter != ‘E’);
}
//Append function enabling user to input data
void writeData(void) {
ofstream outMyStream(FileName, ios::app);
string name = “”;
string street = “”;
string city = “”;
string state = “”;
string zipCode = “”;
char yesOrNo;
if (outMyStream.is_open()) {
do {
cout << “\nEnter The Name: “;
cin.ignore();
getline(cin, name);
cout << “\nEnter The Street: “;
getline(cin, street);
cout << “\nEnter The City: “;
getline(cin, city);
cout << “\nEnter The State: “;
getline(cin, state);
cout << “\nEnter The Code: “;
cin >> zipCode;
outMyStream << name << “#” << street << “#” << city << “#” << state << “#”
<< zipCode << “#”;
cout << “\nEnter another Record? (Y/N)”;
cin >> yesOrNo;
yesOrNo = toupper(yesOrNo);
} while (yesOrNo == ‘Y’);
}else {
cout << “Unable to open file”;
}
outMyStream.close();
}
//Output function
void readData(void) {
ifstream inMyStream(FileName);
if (inMyStream.is_open()) {
string delim = “”;
delim.assign(20, ‘-‘);
int fieldCount = 1;
int recordCount = 1;
string fieldBuffer;
getline(inMyStream, fieldBuffer, ‘#’);
while (!inMyStream.eof()) {
switch (fieldCount) {

Preview

CIS170C Programming Append Function Enabling User to Input Data DeVry University

NOTE: Please check the details before purchasing the document.

error: