Develop a program to sort a file consisting of bonks details in the alphabetical order of author names. The details of books include book id, author_name, price. no of pages, publisher, year of publishing
Please provide C++ program for above question.​

Answers

Answer 1

Use the knowledge in computational language in C++ to write the a code with alphabetical order of author name.

How to define an array in C++?

An Array is a set of values ​​arranged in lists and accessible through a positive numeric index. So, we have that each position of our Array is a variable of the type of our Array, so we have to have a way to initialize this set of variables.

#include <iostream>

#include <iomanip>

#include <fstream>

#include <string>

using namespace std;

struct Book {

   string title;

   string author;

};

const int ARRAY_SIZE = 1000;

Book books [ARRAY_SIZE];

string pathname;

ifstream library;

int LoadData();

void ShowAll(int count);

void ShowBooksByAuthor(int count, string name);

void ShowBooksByTitle(int count, string title);

void sortByTitle(int count, string title);

void sortByAuthor(int count, string author);

int main()

{  

   int count = 0;

   char selector = 'q', yesNoAnswer = 'n';

   string name;

   string title;

     cout << "Welcome to Forrest's Library Database." << endl;

   cout << "Please enter the name of the backup file: ";

   getline(cin, pathname);

   LoadData();

   count = LoadData();

   cout  << count << " records loaded successfully." << endl;

   do

   {

       cout << endl << "\t(S)how All, Search (A)uthor, Search (T)itle, (Q)uit: ";

       cin >> selector;

       selector = toupper(selector);

       switch(selector)

       {

           case 'S':

               sortByTitle(count, title);

               if (count <= 0)

                   cout << "No counts found!\n";

               else

                   ShowAll(count);

               break;

           case 'A':

               sortByAuthor(count, name);

               cout << "bookAuthor: ";

               cin.ignore();

               getline(cin, name);

               if (count <= 0)

                   cout << "No records found!\n";

               else

                   ShowBooksByAuthor(count, name);

               break;

           case 'T':

               sortByTitle(count, title);

               cout << "bookTitle: ";

               cin.ignore();

               getline(cin, title);

               if (count <= 0)

                   cout << "No records found!\n";

               else

                   ShowBooksByTitle(count, title);      

               break;

       }

   }

   while (selector != 'q' && selector != 'Q');

   return 0;

}

int LoadData()

{

   int count = 0;

   int i = 0;

   library.open(pathname);

   ifstream library(pathname);

   if (!library)

   {

       cout << "Cannot open backup file" << endl;

       return 0;

   }

   while (!library.eof())

   {

       getline(library, books[count].title);

       getline(library, books[count].author);

       count++;

   }

   return count;

}

void ShowAll(int count)

{

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

   {

      cout << books[i].title << " " << "(" << books[i].author << ")" << endl;

   }

}

void ShowBooksByAuthor(int count, string name)

{

   int j = 0;

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

   {

       if(books[i].author.find(name) < 100)

       {

           cout << books[i].title << " " << "(" << books[i].author << ")" << endl;

           j++;

       }

   }

   cout << j << " records found";}

void ShowBooksByTitle(int count, string title)

{

   int j = 0;

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

   {

       if(books[i].title.find(title) < 100)

       {

           cout << books[i].title << " " << "(" << books[i].author << ")" << endl;

           j++;

       }

   }

   cout << j << " records found";

}

void sortByTitle(int count, string title) {

   string temp;

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

       for(int j = 0; j < count - i; j++) {

           if (books[j].title > books[j + 1].title) {

               temp = books[j].title;

               books[j].title = books[j + 1].title;

               books[j + 1].title = temp;

           }

       }

   }

}

void sortByAuthor(int count, string name) {

   string temp;

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

       for(int j = 0; j < count - i; j++) {

           if (books[j].author > books[j + 1].author) {

               temp = books[j].author;

               books[j].author = books[j + 1].author;

               books[j + 1].author = temp;

           }

       }

   }

}

See more about C++ at brainly.com/question/19705654

Develop A Program To Sort A File Consisting Of Bonks Details In The Alphabetical Order Of Author Names.
Develop A Program To Sort A File Consisting Of Bonks Details In The Alphabetical Order Of Author Names.
Develop A Program To Sort A File Consisting Of Bonks Details In The Alphabetical Order Of Author Names.

Related Questions

what is the name of the extension used to save publisher

Answers

Answer:

PUB

Explanation:

PUB IS THE NAME OF THE EXTENSION USED TO SAVE PUBLISHER

Write a function named count_vowels that accepts two arguments: a string and an empty dictionary. The function should count the number of times each vowel (the letters a, e, i, o, and u) appears in the string, and use the dictionary to store those counts. When the function ends, the dictionary should have exactly 5 elements. In each element, the key will be a vowel (lowercase) and the value will be the number of times the vowel appears in the string. For example, if the string argument is 'Now is the time', the function will store the following elements in the dictionary: 'a': 0 • 'e': 2 'i': 2 'o': 1 'u': 0 The function should not return a value.

Answers

The function that counts the number of times a vowel exist in a string is as follows:

def count_vowels(string, dictionary):

    vowels = 'aeiou'

    dictionary = {}.fromkeys(vowels, 0)

    for i in string:

         if i in vowels:

              dictionary[i] += 1

    return dictionary

print(count_vowels("trouble", {}))

Code explanation.

The code is written in python.

we defined a function named "count_vowels". The function accept a string and an empty dictionary.Then. we store the vowels in a variable vowels.The dictionary is used to store the key value pair i.e the vowels and the number of times they appear.We looped through the string.If any value in the string is in vowels,  we increase the dictionary values by 1.Then, we return the dictionary.Finally, we call the function with it parameters.

learn more on function here: https://brainly.com/question/27219031

positive and negative of adblock plus

Answers

Answer:

Pros and cons of ad blockers

Remove distracting ads, making pages easier to read.

Make web pages load faster.

Keep advertisers from tracking you across websites.

Reduce bandwidth (especially important with mobile devices)

Reduce battery usage (again, important for mobile devices)

p

Fumiko is a network technician. She is configuring rules on one of her company's externally facing firewalls. Her network has a host address range of 192.168.42.140-190. She wants to allow all hosts access to a certain port except for hosts 188, 189, and 190. What rule or rules must she write

Answers

The rule that she must write is that  A single rule allowing hosts 140–187 is all that is necessary; the default-deny rule takes care of blocking the remaining nonincluded hosts.

What is a Firewall?

A firewall is known to be a form of a network security device that helps one to manage, monitors and filters any form of incoming and outgoing network traffic.

This is often done based on an firm's formerly set up security policies. A  firewall is known as the barrier that exist between a private internal network and the public Internet.

See options below

What rule or rules must she write?

a) A single rule allowing hosts 140–187 is all that is necessary; the default-deny rule takes care of blocking the remaining nonincluded hosts.

b) Multiple rules are necessary for this configuration; one or more rules must define Deny exceptions for 188, 189, and 190, followed by the Allow rule for the 140–190 range.

c) A Deny rule is needed for 188, 189, and 190, and then exception rules for the 140–187 range.

d) The default Deny all rule needs to be placed first in the list, and then an exception rule for the 140–187 range.

Learn more about firewalls from

https://brainly.com/question/13693641

6. What are the arguments, pros and cons, for Python's use of indentation to specify compound statements in control statements

Answers

Answer:

[tex]beinggreat78~here~to~help.[/tex]

In some cases, one con is that it can be hard to keep track of your identation when coding long lines or blocks. The pro is that you may need to learn, which is not a bad thing. Learning is good.

Mike logged into a shopping website and entered his username and password. Which protocol will the website use to verify his credentials?

Answers

Answer:

I think it is email or password

What year was internet inverted

Answers

[tex]\large\blue{\mid{\underline{\overline{\tt { →\:January \:1, 1983}\mid}}}}[/tex]

ARPANET→Advanced Research Projects Agency Networkthe forerunner of the Internet.

[tex]\purple{\rule{15mm}{2.9pt}} \red{\rule18mm{2.5pt}} \orange{ \rule18mm{2.5pt}}[/tex]

[tex]\sf{\:мѕнαcкεя\: ♪...}[/tex]

explains why it is important to select the correct data when creating a chart

Answers

Answer:

to be organized

Explanation:

because when you are organized to select the correct data, you won't confused

Write a program that uses while loops to perform the following steps:
a. Prompt the user to input two positive integers. Variables: firstNum and secondNum
(firstNum must be less than secondNum) (use while loop); create a user-defined function
called validateUserInput() to validate the user's input. Use Call-by-Value.
validateUserInput() is a value returning function.

b. Output all odd numbers between firstNum and secondNum. (use while loop); create a
user-defined function called oddNumbers(). Use Call-by-Value. oddNumbers() is a void
function.

c. Output the sum of all even numbers between firstNum and secondNum. (use while
loop); create a user-defined function called sumEvenNumbers(). Use Call-by-Value.
Declare a variable called sumEven in the main() for the sumEvenNumbers().
sumEvenNumbers() is a valuereturning function. Use sumEven to hold a returned value.

d. Output the numbers and their squares between 1 and 10. (use while loop): create a
user-defined function called displaySquareNumbers(). Call-by-Value.
displaySquareNumbers() is a void function.

e. Output the sum of the square of the odd numbers between firstNum and secondNum.
(use while loop); create a user-defined function called sumSqureOddNumbers(). Use
Call-by-Value. Declare a variable called sumSquareOdd in the main(), for the

sumSqureOddNumbers(). sumSqureOddNumbers() is a value returning function. Use
sumSquareOdd to hold a returned value.

f. Output all uppercase letters. (use while loop); create a user-defined function called
displayUppercaseLetters(). Use Call-by-Value. displayUppercaseLetters() is a void
function.

Answers

The program is an illustration of the loop and functions

Loops are used to perform repetitive operationsFunctions are named code segments that ar executed when called or evoked

The main program

The program written in Python, where comments are used to explain each action is as follows:

#This function validates the user input

def validateUserInput(firstNum, secondNum):

   if firstNum >= secondNum:

       return False

   return True

See attachment for the complete program

Read more about loops at:

https://brainly.com/question/19347842

nivel 1: operadores pedir 2 números al usuario y Sumarlos, restarlos, multiplicarlo y dividirlos ​

Answers

Answer:

¿Esta pregunta no tiene ningún sentido?

Explanation:

¿que estas pidiendo?

Which evidence best addresses the counterclaim?

a story about a girl who becomes a professional athlete after she graduates
quotations from teens and parents who fight with coaches
a story about a boy who gets bad grades because he plays too many sports
an example of how sports may lead to many injuries


an exclamation point
an exclamation point

Answers

Answer:

A. a story about a girl who becomes a professional athlete after she graduates

Explanation:

i hope this helped

a) Explain any two problems associated with the existing system used by the organization. (25 marks)​

Answers

Answer:

Lack of Strategy

Many of the most common MIS issues can be traced back to a lack of a solid strategy. Information systems leaders are well aware of the many tools available to gather data on their network. But putting that information to use is often a challenge.

At one time, technology departments served as a separate operation, providing tech support and keeping an organization’s server equipment running. Today, MIS leadership often sits alongside other business leaders, working together to ensure that the technology being used supports the overall mission of the company moving forward.

Meeting Organizational Needs

MIS plays an ever-increasing role in organizations, with professionals relying on technology for every aspect of operations. Sales and marketing rely heavily on customer relationship software to track client interactions, for instance, while accounting needs its own software for billing, invoicing and financial tracking.

With more than half of all companies now relying on big data analytics, MIS is playing an even more important role. Before making a decision, today’s management teams are likely to pull reports on existing activity to ensure they use facts rather than make educated guesses.

Explanation:

I need help with these certain questions on my activities in school

Answers

Answer:

*part 3 multiple choice*

1 d. none of the above

2d. water

3 a. insulator

*The Other Part*

4. electrons change direction of flow frequency in ""alternating current""

2. conductors

every CAD application comes with a color menu to help you tailor your selections, mix them properly, and apply them in ways that meet your artistic expectations

true or false

Answers

every CAD application comes with a color menu to help you tailor your selections, mix them properly, and apply them in ways that meet your artistic expectations is a true statement.

What is a color CAD?

In a CAD system, there is found to be colors that are known to be often and  most commonly used to depict line weights.

Note that selecting different colors is easy using varying line thickness. One can then use these colors into layers to smooth the visibility of drawing components that you wants.

Learn more about CAD application  from

https://brainly.com/question/9222927

Answer:true

Explanation:

12.2 E-Z LOAN
A loan obtained from a lending institution is typically paid off over time using equal monthly payments over a term of many months. For each payment, a portion goes toward interest and the remaining amount is deducted from the balance. This process is repeated until the balance is zero. Interest is calculated by multiplying the current balance by the monthly interest rate, which is usually expressed in terms of an Annual Percentage Rate (APR). This process produces an Amortization Schedule where the amount applied to interest is gradually reduced each month and the amount applied to the balance grows. For example, the following amortization schedule is for a loan of $ 10.000 at an APR of 3.9% over a term of 30 months:3 will match months 12, 24, and 30 respectively.

Answers

Following an amortization schedule, the monthly payments will be $350.39 and the total payment in 30 months will be $10511.7.

How much should be paid monthly to complete loan payment in 30 months?

The loan payment follows an amortization schedule where the amount applied to interest is gradually reduced each month and the amount applied to the balance grows.

The amounts to be paid is calculated using the amortization formula:

P = a ÷ {{[(1 + r/n)^nt] - 1} ÷ [r/n(1 + r/n)^nt]}

where

P is monthly paymenta is credit amountr is the interest ratet is the time in yearsn is number of times the interest is compounded

For the loan of $10000;

a = $10000r = 3.9% = 0.039nt = 30 months

Hence,

P = $10000 ÷ {{[(1 + 0.039/12)^60] - 1} ÷ [0.039/12(1 + 0.0.039/12)^60]}

P = $350.39 per month

Total payment in 30 months = $350.39 × 30 = $10511.7

Therefore, the monthly payments will be $350.39 and the total payment in 30 months will be $10511.7.

Learn more about amortization schedule at: https://brainly.com/question/26433770

Steps of booting a computer

Answers

Steps of Booting
The Startup. It is the first step that involves switching the power ON. ...
BIOS: Power On Self Test. It is an initial test performed by the BIOS. ...
Loading of OS. In this step, the operating system is loaded into the main memory. ...
System Configuration. ...
Loading System Utilities. ...
User Authentication.

how to Develop Administrative Assistant Skills

Answers

Answer:

Multitasking, Flexible and resourceful.

Explanation:

im not sure what your asking for but to be or i dont now how to explain to good but hope you get what im mean it no brainier

what is containment and why is it part of the planning process

Answers

Answer:

Isolating affected channels, processes, services, or computers; stopping the losses; and regaining control of the affected systems. It is part of the planning process to identify the best containment option for each scenario or system affected.

Explanation:

The major goal of a good web information
a
retrieval system is

Answers

Answer:

Explanation:

The major objective of an information retrieval system is to retrieve the information – either the actual information or the documents containing the information – that fully or partially match the user's query.

i need the full code for 6.1.3 code hs circles and squares please answer please help

Answers

In this exercise we have to use the knowledge in computational language in python  to write a code with circles and squares.

how to draw geometric figures in python?

inputs = 100

radius

   draw_circle(radius);

   pendown()

   begin_fill()

   circle(radius)

   end_fill()

   penup()

left(90)

forward(radius*2)

right(90)  

penup()

setposition(0,-200)

color("gray")

bottom_radius = int(input("What should the radius of the bottom circle be?: "))

draw_circle(bottom_radius)

draw_circle(bottom_radius)

See more about python at brainly.com/question/18502436

what is computers machain?

Answers

Answer:

the electronic device which take data process it and give meaningful results is called computer machine

One problem with backlighting is that your subject may squint.

True

False

Answers

Answer:

I would say that's False. Backlighting would be behind them. So they wouldn't need to squint.

Explanation:

These are raised as livestock for meat and milk EXCEPT one
A. Hog
B. Goat
C. Carabao
D. Cattle

Answers

The livestock that is not raised for  meat and milk is  hog.

What are animals raised for meat?

Livestock are known to be some domesticated animals that are said to be raised in an agricultural farm to give labor and produce things such as meat, eggs, milk, etc.

The animals that are raised for their meat and milk are:

Boar BroilerCattle, etc.

Learn more about animals from

https://brainly.com/question/25897306

Which of the following are vector graphic file formats? Choose all that apply.

AI

PNG

RAW

SVG
Please help

Answers

There are different kinds of files. The option that is a vector graphic file formats is SVG.

What are vector files?

Vector files are known to be a type of images that are created by using mathematical formulas that stands as points on a grid.

The SVG  is known as Scalable Vector Graphics file and it is known to be a  vector image file format as it make use of geometric forms such as points, lines, etc.

Learn more about vector graphic file from

https://brainly.com/question/26960102

Answer:

AI and SVG

Explanation:

learned it from a comment i give all credit to them

How many intrusion switches are there in Dell Precision Tower 7920?

Answers

The number of  intrusion switches in Dell Precision Tower 7920 is one.

What is an intrusion switch?

There is an chassis intrusion switch that is often used in the detection of any unauthorized access that is found stepping into the interior of one's system.

This kind of switch is known to be often activated quickly when the system cover is removed and access is done or made to the interior of one's system.

Learn more about intrusion switch from

https://brainly.com/question/24369537

9.11: Array Expander
Write a function that accepts an int array and the array’s size as arguments. The function should create a new array that is twice the size of the argument array. The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0. The function should return a pointer to the new array. Demonstrate the function by using it in a main program that reads an integer N (that is not more than 50) from standard input and then reads N integers from a file named data into an array. The program then passes the array to your array expander function, and prints the values of the new expanded array on standard output, one value per line. You may assume that the file data has at least N values.

Prompts And Output Labels. There are no prompts for the integer and no labels for the reversed array that is printed out.

Input Validation. If the integer read in from standard input exceeds 50 or is less than 0 the program terminates silently.

Answers

The Array Expander is an illustration of arrays and functions.

Arrays are variables that stores multiple valuesFunctions are named statements that are executed when called

The Array Expander program

The Array Expander program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

//This declares the Array Expander function

int* ArrayExpander(int *oldArr, int size){

   //This declares the new array

   int *newArr = new int[size * 2];

//This iteration sets values into the new array

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

       if(i < size){

           *(newArr+i) = *(oldArr+i);

       }

       else{

           *(newArr+i) = 0;

       }

   }

//This returns a pointer to the new array

   return newArr;

}

//The main method begins here

int main(){

//This declares the length of the array, N

   int N;    

//This gets input for N

   cin>>N;

   int initArr[N];

//If N is between 1 and 50

   if(N > 0 && N <=50){

//This iteration gets values for the array

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

           cin>>initArr[i];

       }

//This calls the Array Expander function

   int *ptr = ArrayExpander(initArr, N);

//This iteration prints the elements of the new array

   for (int i = 0; i < N*2; i++) {

       cout << ptr[i] << " ";

   }

   }

  return 0;

}

Read more abou C++ programs at:

https://brainly.com/question/27246607

20) Which of the following functions would take the word "Joe" (found in column A) and "Smith" (found in column B), and display "Joe Smith" in column C?

A. COMBINETEXT


B. TEXTJOIN


C. JOINTEXT


D. JOIN

Answers

Answer:

TEXTJOIN

Explanation:

TEXTJOIN is a common function of Ms Excel or Microsoft Excel

This function requires three arguments

delimiterignore_empty text1.

Answer:

TextJoin

Explanation:

Is the functions would take the word "Joe" (found in column A) and "Smith" (found in column B), and display "Joe Smith" in column C.

what is the future of web development

Answers

Answer:

Creating websites that can execute automated tasks and new programing languages revolving around web development.

Explanation:

Text based game project 1

Answers

Answer:

What is your question?

Explanation:

What is a value which we pass to the function to use in place of the parameter when we call it?

A. Parameter
B. Call
C. Procedure
D. Argument

Answers

Answer:
D) Argument

Explanation:
When you call a function, you pass in an argument as the input to use in the place of the parameter.
Other Questions
What groups of elites struggled for power in Latin America in the 1800s? Michael has $1,059.35 in his checking account. He is going to spend $466.43 on a new television, and he will spend the rest on speakers that cost $43.00 each. Which of the following inequalities would determine the maximum number of speakers, x, Michael can buy without spending more money than he has in his account? A. $466.43 < $43.00x + $1,059.35 B. $1,059.35 < $43.00x + $1,059.35 C. $466.43 + $43.00 + x < $1,059.35 D. $43.00x + $466.43 < $1,059.35 What is the absolute value of -|-4| ? 1010UUg(x)f(x)810-210-82-108--224-8- 10If g(x) = f(x + k), what is the value of k? A drug prescription of 45 pills costs $427. 95. If each pill contains 3 mg of medication, what is the cost per milligrams? Complete the sentences with the correct term.Costpush inflation occurs when ____(short-run aggregate supply / aggregate demand)____ decreases until equilibrium output falls below the full employment level.As a result, the ____(equilibrium output level / price level)_____ increases.One possible cause of costpush inflation is an increase in ____(technology / the costs of inputs)_____.To combat falling aggregate output, the government may introduce policies to increase ____(aggregate demand / long-run aggregate supply)_____ to the point where it and shortrun aggregate supply intersect ____(aggregate demand / long-run aggregate supply)_____ at the same point.These policies cause ____(the price level / equilibrium output)____ to return to its full employment level, and the ____(level of output / price level)_____ increases even further. The Temporary Assistance for Needy Families is a part of which state agency? A. Department of Administrative Services B. Department of Behavioral Health and Developmental Disabilities C. Department of Education D. Department of Human Services Tyger spends 25 minutes studying mathematics, 35 minutes studying science and 40 minutes studying history. What percentage of his time is spend studying science? A frog starts jumping from the middle of a circular pond.The pond is 12 metres across, from one side to the other.43The frog always jumps half the distance left to the edge of the pond.How far is the frog from the edge after 3 jumps? Consider this graph of a standard normal curve.What percentage of data is represented by the shaded area?Enter your answer as a number, like this: 42% Find the length of the third side. If necessary, round to the nearest tenth.913 The ___________ person sounds like a hypocrite when he preaches to a friend about the evils of drugs, while he drinks one beer after another. what is the Median of the numbers 45, 40, 47, 50, 45, 49, 40, 46? Solve the word problem below.Jane took out $135 from her checking account. If Jane now has a balance of $650 in heraccount, how much did Jane have in the account before she took out any money?Step 1: If x represents the variable in the word problem above, explain what the variable shouldrepresent. Step 2: Write an equation to model the situation. Step 3: Solve the equation and write your answer in sentence form. Show your work. A coarse particle has a diameter of 1x10-6m. a nanoparticle has a diameter of 1.6 x 10-9m. Calculate how many times bigger the diameter of the coarse particle is than the diameter of the nanoparticle In "We Wear the Mask," the mention of "tortured souls" suggests __________ about the way the speaker has been treated.A. AmusementB. A forgiving attitudeC. BitternessD. A lack of concernPoem Below:We wear the mask that grins and lies,It hides our cheeks and shades our eyes,This debt we pay to human guile;With torn and bleeding hearts we smile,And mouth with myriad subtleties.Why should the world be overwise,In counting all our tears and sighs?Nay, let them only see us, whileWe wear the mask.We smile, but, O great Christ, our criesTo thee from tortured souls arise.We sing, but oh the clay is vileBeneath our feet, and long the mile;But let the world dream otherwise,We wear the mask Division ABC has $750,000 in average assets and $200,000 in income. Division XYZ has $800,000 in average assets and $210,000 in income. The company's target rate is 10%. Which division has the highest residual income Cara computes the mean and variance for the set 87, 46, 90, 78, and 89. She finds the mean to be 78. Her steps for finding the variance are shown below. Variance squared = StartFraction (87 minus 78) squared + (46 minus 78) squared + (90 minus 78) squared + (78 minus 78) squared + (89 minus 78) squared Over 5 EndFraction Variance squared = StartFraction (9) squared minus (32) squared +BACK Which budget items (costs) would you include and exclude in your training budget? Which of the following can be categorized as a primary activity?