1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaK [193]
2 years ago
11

class llist { private: record * start; char filename[16]; int readfile(); int writefile(); record * reverse(record * ); void cle

anup(); public: llist(); llist(char[]); ~llist(); int addRecord(int, char [ ],char [ ]); int printRecord(int); // replace printAllRecords() with the << operator int modifyRecord(int, char [ ]); int deleteRecord(int); void reverse(); };
Computers and Technology
1 answer:
Sophie [7]2 years ago
8 0

Answer:

See Explaination

Explanation:

#include <cstdlib>

#include <iostream>

#include <iomanip>

#include <fstream>

#include <string>

#include <sstream>

using namespace std;

struct Person

{

string name;

string addr;

string phone;

string id;

};

const int MAX_SIZE = 8;

void addData(Person list[], int& size);

void dispData(const Person list[], int size);

void delData (const Person list[], int size);

void saveFile(const Person list[], int size);

void openFile(Person list[], int& size);

char getMenuResponse();

int main(int argc, char *argv[])

{

Person contactList[MAX_SIZE];

int numOfRecs = 0;

bool run = true;

do

{

cout << "Address Book - " << numOfRecs << " Number of Contacts" << endl;

switch ( getMenuResponse() )

{

case 'A': addData(contactList, numOfRecs); break;

case 'D': dispData(contactList, numOfRecs); break;

case 'T': delData(contactList, numOfRecs); break;

case 'O': openFile(contactList, numOfRecs); break;

case 'S': saveFile(contactList, numOfRecs); break;

case 'Q': run = false; break;

default : cout << "That is NOT a valid choice" << endl;

}

} while (run);

cout << endl << "Program Terminated" << endl;

return EXIT_SUCCESS;

}

void addData(Person list[], int& size)

{

Person tmp;

char response;

char str[256];

if (size < MAX_SIZE) {

system("cls");

cout << "Enter Contact Information" << endl << endl;

cout << "Name: ";

cin.getline(str, 256, '\n');

tmp.name = str;

cout << endl;

cout << "Address: ";

cin.getline(str, 256, '\n');

tmp.addr = str;

cout << endl;

cout << "Phone Number: ";

cin.getline(str, 256, '\n');

tmp.phone = str;

cout << endl;

cout << "E-mail id Address: ";

cin.getline(str, 256, '\n');

tmp.id = str;

cout << endl;

cout << "Add Contact to Address Book? (y/n) ";

cin >> response;

if (toupper(response) == 'Y')

list[size++] = tmp;

} else {

cout << "Sorry, Address Book is currently full." << endl;

system("pause");

}

system("cls");

}

void dispData(const Person list[], int size)

{

system("cls");

if(size < 1)

{

cout << "Nothing to display" << endl;

} else {

cout << "Contacts :" << endl << endl;

cout << fixed << setprecision(2);

cout << "Contact Name Address Phone No. ID" << endl;

cout << left;

for (int i = 0; i < size; i++)

{

cout << setw(10) << list[i].name << right

<< setw(10) << list[i].addr<<right

<< setw(10) << list[i].phone<<left

<< setw(15) << list[i].id<<left<<endl;

}

cout << right << setw(3) << size;

cout << " Contacts"<< endl;

}

system("PAUSE");

system("cls");

}

void delData(const Person list[],int size) {

vector<Person> :: iterator vItr = Contact.begin();

while (vItr != Contact.end() )

{

if (vItr->Name == Name)

{

vItr = Contact.erase (vItr);

break;

}

else

vItr++;

}

void saveFile(const Person list[], int size) {

string fileName;

ofstream outfi;

cout<<"Enter file name: ";

getline(cin,fileName);

outfi.open(fileName.c_str());

if (!outfi.fail()) {

system("cls");

cout << "Saving Address Book to the disc ";

for(int i = 0; i < size; i++) {

outfi << list[i].name << ';'

<< list[i].addr<< ';';

if (i < size-1) outfi << endl;

}

cout << endl << size << " Address Book in the disc." << endl;

outfi.close();

system("PAUSE");

system("cls");

}

else {

cout << "ERROR: problem with file" << endl;

system("PAUSE");

system("cls");

}

}

void openFile(Person list[], int& size)

{

ifstream infi("AddressBook.txt");

string str;

stringstream strstrm;

if (!infi.fail()) {

system("cls");

cout << "Reading Address Book from the disc ";

size = 0;

while(!infi.eof() && size < MAX_SIZE)

{

getline(infi, str, ';');

list[size].name = str;

getline(infi, str, ';');

strstrm.str(""); strstrm.clear();

strstrm << str;

strstrm >> list[size].addr;

}

cout << endl << size << " read contacts from the disc." << endl;

system("PAUSE");

system("cls");

}

else {

cout << "ERROR :file not accepted" << endl;

system("PAUSE");

system("cls");

}

}

char getMenuResponse()

{

char response;

cout << endl << "take chioce" << endl

<< "(A)dd contact, (D)isplay contact0, (O)pen File, (S)ave File, (Q)uit" << endl

<< "> ";

cin >> response;

cin.ignore(256, '\n');

return toupper(response);

}

You might be interested in
You cannot advance slides during the slide show by pressing the PAGE DOWN key
noname [10]
<span>You cannot advance slides during the slide show by pressing the PAGE DOWN key.
This is a true statement.
</span>
4 0
3 years ago
A table with a width set to 600 pixels will look ________ on a monitor with resolution set to 640 × 480 than on a monitor with r
egoroff_w [7]
There are no options.

It would, however, look larger.
3 0
3 years ago
MOA115 Medical Records and Insurance
Kay [80]

Based on the information given about the insurance, it should be noted that there's a difference between the covered and charged amount.

<h3>What is an insurance?</h3>

From the complete question, an insurance means a policy where an individual is entitled to financial protection.

In this case, there's a difference between the covered andd charged amount. Also, based on the table, the amount that Yan will be responsible for is 12.17.

Learn more about insurance on:

brainly.com/question/25855858

6 0
2 years ago
What does the headgear of a mine do
deff fn [24]
Hard to answer to short but I will try the head gear let's you talk to people on the internet
5 0
3 years ago
Read 2 more answers
Which tab is used to insert a hyperlink onto a slide?
babunello [35]

the answer is C. Insert

3 0
3 years ago
Other questions:
  • Write an interactive Python calculator program. The program should allow the user to type a mathematical expression, and then pr
    13·1 answer
  • To arrange data in alphabetical order quickly, you can _____ the data.
    7·2 answers
  • After clicking the Start button on your computer screen desktop, what option would you then select to examine system components
    10·2 answers
  • How do emotions affect purchasing decisions?
    6·1 answer
  • Determine whether the phrase below is a sentence or a fragment.
    12·1 answer
  • HI How are you anyways are any of you intreseted in my giveaway
    7·2 answers
  • What is GIGO ?<br>plz answer me​
    7·1 answer
  • What do you hope will be in/added GTA 6?
    13·1 answer
  • "Rights and duties are two sides of the same coin." Explain with examples​
    5·1 answer
  • Berat wants to compare images of what the streets of New York City looked like one hundred years ago to now. Which of the follow
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!