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
Minchanka [31]
3 years ago
15

class student_record { public: int age; string name; double gpa; }; Implement a void function that has five formal parameters: a

dynamic array of student_records, the count (number of student_records in the array), an integer, a string, and a double. The function will delete a student record in the dynamic array with age, name and gpa fields that match the age, name and gpa fields that are given in the formal parameters. Remember, to check to see if the dynamic array is empty because you cannot delete from an empty array.
Computers and Technology
1 answer:
Setler79 [48]3 years ago
8 0

Answer:

void delete_record(student_record *arr, int &size, int age, string name, double gpa) {

int index = -1;

if (arr != NULL && size > 0) {

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

if (arr[i].age == age && arr[i].name == name && arr[i].gpa == gpa) {

index = i;

break;

}

}

}

if (index != -1) {

for (int i = index; i < size - 1; ++i) {

arr[i] = arr[i + 1];

}

size--;

}

}

You might be interested in
Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and u
vlabodo [156]

Answer:

Follows are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main() //defining main method

{

const int NUM_GUESSES = 3;//defining an integer constant variable NUM_GUESSES

int userGuesses[NUM_GUESSES];//defining an array userGuesses

int i = 0;//defining integer variable i

for(i=0;i<NUM_GUESSES;i++)//defining for loop for input value

{

cin>>userGuesses[i];//input array from the user end  

}

for (i = 0; i < NUM_GUESSES; ++i)//defining for loop fore print value  

{

cout <<userGuesses[i] << " ";//print array value with a space

}

return 0;

}

Output:

9

5

2

9 5 2  

Explanation:

In the above-given program, an integer constant variable NUM_GUESSES is defined that holds an integer value, in the next step, an integer array "userGuesses" is defined, which holds NUM_GUESSES value.

In the next step, two for loop is defined, in the first loop, it is used for an input value, and in the second loop, it prints the array value.    

6 0
3 years ago
Difference between Hard copy and Soft copy?​
otez555 [7]

Answer: a hard copy is a printed or physical copy of a document, while a soft copy is a virtual or online copy of the document that is stored on your hard drive or computer.

Explanation:

8 0
3 years ago
What is the most important reason to create a backup of your files somewhere other than your computer
Marizza181 [45]
The most important reason we should make a backup of our files on a USB or other device is in case our computer suddenly dies. If something in it goes bad and it stops working, you will have then lost everything on your computer. But, if you make a save, you can buy another computer and upload everything onto the new one.
6 0
4 years ago
I hate these homework it's very hard and I need help
liubo4ka [24]
Ethics is the answer I believe
8 0
3 years ago
What kind of software is Microsoft Outlook??
NNADVOKAT [17]

Answer:

Email software

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which process should be
    14·1 answer
  • Modify the definition of the throttle class on page 35, to create a new throttle ADT, which allows the user of the ADT to specif
    6·1 answer
  • What data does Bittorrenting uses? Explain.
    5·1 answer
  • When completing an application what color ink do you use
    8·2 answers
  • What is a preemptive CPU scheduling algorithm? Give an example and explain.
    7·1 answer
  • How many worksheets display in the Excel window when you create a new blank workbook?
    10·2 answers
  • The first thing you should select if you're using an Address Block or Greeting Line is
    11·1 answer
  • 8.10 Code Practice Question 3
    6·1 answer
  • Write a MY SQL query to display the name and hire date of all employees who were hired in 1992.
    9·1 answer
  • Write a python program to change variable value of your previous result percentage to your current percentage of mid-term
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!