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
Describe the information technology industry today
Volgvan

Answer:

The information technology (IT) sector includes companies that produce software, hardware, or semiconductor equipment, and companies that provide internet or related services.

Explanation:

6 0
1 year ago
If your DTP document contains watermarks on every page, where can you place them?
QveST [7]

Answer:

<h3>You can place watermarks and other recurring elements on a DTP document by following the points below:</h3><h3 />
  • Open the DTP document on which watermark is to be placed.
  • Click on Page Layout tab
  • Locate the Page Background group and click it.
  • Select the Watermark Option and then select Custom watermark.
  • A box will open when you click the Text Watermark.
  • Type the text you want and click on Insert.
  • All other changes can be done using options.

<h3>I hope it will help you!</h3>

6 0
3 years ago
Viết chương trình hoàn chỉnh các yêu cầu sau:
Blababa [14]

Explanation:

the perimeter of an aluminium sheet is 120 CM if its length is reduced by 10% and its breadth is increased by 20% the perimeter does not change find the measure of the length and the breadth of the sheet

4 0
3 years ago
For two integers m and n, their GCD(Greatest Common Divisor) can be computed by a recursive function. Write a recursive method g
konstantin123 [22]

Answer:

In Python:

def gcd(m,n):

if n == 0:

 return m

elif m == 0:

    return n

else:

 return gcd(n,m%n)

Explanation:

This defines the function

def gcd(m,n):

If n is 0, return m

<em> if n == 0: </em>

<em>  return m </em>

If m is 0, return n

<em> elif m == 0: </em>

<em>     return n </em>

If otherwise, calculate the gcd recursively

<em> else: </em>

<em>  return gcd(n,m%n)</em>

<em />

<em>To call the function to calculate the gcd of say 15 and 5 from main, use:</em>

<em>gcd(15,5)</em>

6 0
3 years ago
In short and brave what is technology?
emmainna [20.7K]

Answer:

technology is a whole means to provide goods needed for the survival and comfort of human life

8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the name of a robot astronaut created by NASA
    14·2 answers
  • A(n) ________ operator, such as the greater than or less than symbol, can be used in a query criterion to limits the results pro
    12·2 answers
  • In a _____ network, each device on the network is attached to a central server. If the server fails, then the other devices will
    8·1 answer
  • As defined by the National Institute of Standards and Technology​ (NIST), "________ is a model for enabling​ ubiquitous, conveni
    11·1 answer
  • Give ways on how to effectively save.​
    15·1 answer
  • Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
    5·1 answer
  • What is data science?​
    15·1 answer
  • 45 points!
    9·1 answer
  • How can the two independent clauses below be combined to form a correct complete sentence? Check all that apply.
    5·1 answer
  • Explain how to add cell A1 and cell B3 in excel
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!