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]
3 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]3 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
A customer is experiencing intervals during the day when the file server on her local network cannot keep up with the demands of
levacccp [35]

Answer: Contact the manufacturer and asks for another filter driver device.

Explanation:This issue can occur if a non-Microsoft program installed on your computer uses an outdated kernel-mode filter driver. And it can be that kernel-mode filter driver may be outdated.

3 0
4 years ago
What does HTML and CSS stand for in coding?
lisov135 [29]
HTML stands for hypertext markup language.
CSS stands for cascading styling sheet.
8 0
3 years ago
What does it mean to say that there is a relationship between two tables?
NeTakaya

Answer:

Definition

Explanation:

A database relationship is a situation between two relational database tables when one table has a foreign key that refers to the other table's primary key.

Relationships allow for the separation and storing of information in different tables when connecting disparate data objects.

4 0
3 years ago
When you are hired to develop a system for an organization. Is it important to follow all the requests/wants of the system owner
Over [174]

If you are hired to develop a system, note that Is it vital to follow all the requests or needs of the system's owner.

The company knows what they want and it is good you do comply with their directives. You can only give your suggestions if need be.

<h3>Who can develop an information system?</h3>

The information systems field is one that is made up of people in organizations that are skilled and can design and build information system.

Note that to be  hired to develop a system, one has to follow all the requests/wants of the system owner instead of the system user as the one who needs it knows what he or she wants so you have to comply with it. You can only give your suggestions.

Learn more about system from

brainly.com/question/13603602

3 0
2 years ago
You are a solutions architect who works at a large retail company that is migrating its existing infrastructure to AWS. You reco
pantera1 [17]

In this case, there are 251 IP addresses available. They are unique addresses for the Internet Protocol.

<h3>What is an IP address?</h3>

An Internet Protocol (IP) address is a unique address on Internet, which is used to indicate a local network.

The term 'Internet Protocol' indicates the principles associated with the format of the data used by the local network.

An Internet Protocol address is always denoted by a set of numerical tags that indicate the local network.

Learn more about IP address here:

brainly.com/question/24930846

6 0
2 years ago
Other questions:
  • How do you return a value from a function?
    6·1 answer
  • 12. In 2009, __________ of all pedestrian fatalities were caused by impaired drivers
    9·2 answers
  • The advent of mobile systems run by Android and other operating systems opens a wide range of new system management and security
    5·1 answer
  • What are the differences in LAN and WAN and how they are used to Increase Cybersecurity
    7·1 answer
  • Help plzzzz_________ provide a means of organizing and summarizing data A. Reports B. Metadata C. Connectors D. All
    9·1 answer
  • How to solve household arithmetic​
    7·1 answer
  • What are some ways you can give staying off your phone a "boost" and make it easier to do?
    9·1 answer
  • Using this statement to answer the following question “FIFA World Cup 2010: (1+9) From Today!” (Ignore Quotation)
    9·1 answer
  • I am trying to code a lifting simulator game on ro-blox. These problems listed in the third picture tells you the problems. If y
    13·2 answers
  • The most popular battery type used in today’s electronic devices is __________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!