Question

Write a C++ code that answers this question 1.Delete all 5 arrays and increase the size...

Write a C++ code that answers this question

1.Delete all 5 arrays and increase the size variable by 1000.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

#include <iostream>

using namespace std;

int main()

{

int size;

cout<<"Enter size: ";

cin>>size;

int* array1 = new int[100]; // declaration of array1

int* array2 = new int[100]; // declaration of array2

int* array3 = new int[100]; // declaration of array3

int* array4 = new int[100]; // declaration of array4

int* array5 = new int[100]; // declaration of array5

delete[] array1; // deletion of of array1

delete[] array2; // deletion of of array2

delete[] array3; // deletion of of array3

delete[] array4; // deletion of of array4

delete[] array5; // deletion of of array5

size = size + 1000; // Increase the size by 1000

cout<<"The value of size after increase the size variable by 1000: "<<size<<endl; // print the new size

return 0;

}

Output:

Add a comment
Know the answer?
Add Answer to:
Write a C++ code that answers this question 1.Delete all 5 arrays and increase the size...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Language C Code Write a program that takes two integer arrays (A and B) and sums...

    Language C Code Write a program that takes two integer arrays (A and B) and sums them together (element wise). A third array to accept the result should be passed in as the output argument. Assume the arrays are all the same size. The argument N is the size of the arrays. Your code should provide a function with the following signature: void array Addition (int A[], int B[], int N, int output[]) { } Your code must also provide...

  • For c++ Write a complete C++ program and declare 2 arrays type double size 5. The...

    For c++ Write a complete C++ program and declare 2 arrays type double size 5. The name of the first array is Salary and the name of the second array is Tax. Use a for loop loop and enter 5 salaries type double into array Salary. Then multiply each element of array Salary by .10 (10 percent), and save the result into array Tax. Print/display the content of both arrays. Hint: the content of array Tax is 10% percent of...

  • Write a C++ console application that adds the corresponding elements of two integer arrays of size...

    Write a C++ console application that adds the corresponding elements of two integer arrays of size five. Prompt the user for the ten values and store the first five in the first array and the second five in the second array. Then create and call function matrixAdd that adds the two arrays and prints the five sums. Here is the function prototype: void matrixAdd(int firstArr[], int secondArr[]); [your program code here]*

  • c++ write a function that has 3 parameters, two arrays of integers of the same size...

    c++ write a function that has 3 parameters, two arrays of integers of the same size , and the size of the arrays. the function should add the two arrays and store the results in a third array, then print out the contents of the third array name it arraya

  • Please help code in c++ and use the answers you get from question 1 and 2...

    Please help code in c++ and use the answers you get from question 1 and 2 into the 3rd answer! Question 1 is first, question 2 is in the middle, question 3 is last Input Array (10 pts) te a function only (no main) that takes an array of doubles as a parameter as well as another integer rray. Create a for loop that asks the user to input any real number between-100 and r each element of the array....

  • Please use simple java code and comments no arrays Write a program that displays all the...

    Please use simple java code and comments no arrays Write a program that displays all the numbers from 100 to 1,000. ten per line, that are divisible by 5 and 6. Numbers are separated by exactly one space.

  • C# code Arrays and Linked Lists: Write C++/Java/C#/Python code to declare an array of linked lists...

    C# code Arrays and Linked Lists: Write C++/Java/C#/Python code to declare an array of linked lists of any primitive type you want. (Array of size 2020) (This could be based on MSDN libraries or the lab) – you do not need to instantiate any of the linked lists to contain any actual values. Paste your code for that here (this should only be one line) Based on your code or the lab from 4 or your doubly linked list from...

  • Need help with java code, this is all in a method 1) 3 different arrays are...

    Need help with java code, this is all in a method 1) 3 different arrays are brought in 2) I create local array called arrayWithLargestValues which is the size of the largest array from the 3 brought in 3) I need to somehow fill the local 'arrayWithLargestValues' with the all different largest values from the 3 different arrays hopefully I made sense sample input/output int [ ] arrayWithLargestValues = new int [ ] // this has to be set to...

  • C++ shot answer question help: Write the code to create an integer array that contains all...

    C++ shot answer question help: Write the code to create an integer array that contains all the numbers that are divisible by 2 in the range from 1 to 1000.   

  • Problem 1: Consider 2 integer arrays, x and y, of the same size (assume size =...

    Problem 1: Consider 2 integer arrays, x and y, of the same size (assume size = 10). Initialize array x with random numbers between 1 and 100. Write code that fills array y with values such that each element of y is the corresponding value of x multiplied by its index.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT