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
bija089 [108]
3 years ago
10

Consider a company that needs to sort an array of structures of type Customer by balance, with the largest balance first. Here i

s the definition of the Customer structure: struct Customer { string name ; double balance ; } In real life the Customer array may have thousands of data members and occupy a large area of memory, making it computationally expensive to move Customer objects around while sorting . In this problem, you will create an array of only 10 structures, say Customer data[10]. You also can define an auxiliary array Customer *pData[10], setting each entry of pData [k] to point to the corresponding entry of data[k]. Write a program that sorts the array of pointers so that when you go through pData in increasing order of index k, the entries pData[k] point to Customer objects in decreasing order by balance, meaning that pdata[0] now points to the customer with the highest balance, and pData[9] points to the customer with the smallest balance.
Computers and Technology
1 answer:
8090 [49]3 years ago
4 0

Answer:

#include <iostream>

#include <string>

#include <cstring>

#include <cstdlib>

using namespace std;

struct Person

{

string name;

int age;

};

int main()

{

struct Person data[10];

struct Person *pData[10],*temp;

string names[] = {"a","b","c","g","z","l","p","q","r","w"};

int num[] = {4,6,34,8,13,90,33,22,18,23};

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

{

data[i].name = names[i];

data[i].age = num[i];

pData[i] = &data[i];

}

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

{

for(int j=i+1;j<9;j++)

{

if(pData[i]->name.compare(pData[j]->name)>0)

{

temp = pData[i];

pData[i] = pData[j];

pData[j] = temp;

}

}

}

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

{

cout<<pData[i]->name<<" "<<pData[i]->age<<endl;

}

}

Explanation:

The line #include <iostream> initializes the program.

This program created an array of only 10 structures, Customer data. Also defined an auxiliary array Customer *pData.

The program uses these parameters to sorts the array of pointers so that when you go through pData in increasing order of index k, the entries pData[k] point to Customer objects in decreasing order by balance, meaning that pdata[0] now points to the customer with the highest balance, and pData[9] points to the customer with the smallest balance.

You might be interested in
Under which access control system is each piece of information and every system resource (files, devices, networks, and so on) l
Pani-rosa [81]

Answer:

C. Mandatory access control

Explanation:

In the implementation of computer security, the mandatory access control (MAC) refers to the implementation of a security feature by operating systems. In this method, individual resource owners’ are unable to deny or grant permissions to a resources contained in a file. The criteria in a MAC when defined by the system administrator is implemented and enforced by the OS.

7 0
3 years ago
The output will be true no matter what the value of input A is. The output will be false no matter what the value of input A is.
anastassius [24]

Answer:

The truth table for the above cases will be:

Case 1

A      OUTPUT

0           1

1            1

Case 2

A      OUTPUT

0            0

1             0

Case 3

A     OUTPUT

0            0

1             1

Case 4

A     OUTPUT

1           0

 0           1

Explanation:

The answer is self explanatory.

6 0
3 years ago
Read 2 more answers
Software that manages and supports the resources of a computer is known as?
irakobra [83]
The answer to this question is

<span>Systems software are programs that manage the resources of the computer system and simplify applications programming. They include software such as the operating system, database management systems, networking software, translators, and software utilities.


If you taken a computer course, it tells you this information.

Hope This Helps!
:D
</span>
3 0
3 years ago
Who plays Rblx?? What do yall play?
djyliett [7]

Answer:

i play rblx

Explanation:

queenloveadriana (main acc)

AdiosLoca (alt)

Azazel_Iblis (the acc I'll use for my YT channel)

I also play Fn, CofD, Destiny, 2k, Mortal Combat, but my PS4 broke and I'm waiting to get my PS5 that I ordered        

8 0
3 years ago
Read 2 more answers
You are instructing a cable installer where to run the UTP cable that goes from the work area on the third floor of your buildin
NeX [460]

Answer: IDF(intermediate distribution frame )

Explanation:

Intermediate distribution frame  is defined as the cable rack that help in interconnection of various workstation devices and workstation .In a building, cables are placed towards a hub MDF and then it gets connected to respective IDF.  

  • According to the question, installer should be advised to run the cable in IDF(intermediate distribution frame ) as it would be a proper rack for cable that can link and interlink various cable of workstation devices such as panel , switches etc and workstation of the building.  
5 0
3 years ago
Other questions:
  • How can you create balance to your drawing using only grayscale values?
    12·1 answer
  • Jimmy is running out of desk space. He keeps three computers on his desk. The three computers can’t be moved, and they need to b
    5·2 answers
  • Which of the following is typically not found in web page-authoring software
    9·1 answer
  • The weakest hydrogen line stars are classified as:
    10·2 answers
  • I need help answering these questions!
    11·1 answer
  • What information should be included in the closing paragraph of a thank-you letter? a. Mention skills that were omitted during t
    6·2 answers
  • Easy 25 points answer what is it called that you use only 1 and 0 like this 1010010011001100011110001010010101001010101010010101
    5·1 answer
  • Steven, Marcos, and Juan are having a free-throw shooting contest. Each boy
    9·1 answer
  • Does access provide email communication
    13·1 answer
  • What is your favorite anime?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!