![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
// Sharissa Sullivan
//January 20 2023
// Chapter 9 Array Expander
// C ++
#include <iostream>
using namespace std;
// prototype arrayExpander
int* arrayExpander(int[], int size);
int main()
{
//create an array - orignial array
int array[] = { 1,2,3, };
int size = 3;
int* arrayPtr = arrayExpander(array, size);
// Print out arrays
for (int i = 0; i, size; i++)
{
cout << arrayPtr[i] << endl;
}
return 0;
}
// function to create new array
int* arrayExpander(int[], int size)
{
// ponits to new array with * size X 2 , and copied vaules from 1st array with 0 for the values
int *expanderArray = new int[size * 2];
// copy orginial array into the second array and doblue the size
for (int i = 0; i < size * 2; i++)
{
if (i < size)
{
// copies the orignal array
expanderArray[i] = array[i]; // LINE 35
}
else
{
//populates the number 0, for the new vaules in exapnder array
expanderArray[i] = 0;
}
}
return expanderArray;
}
LINE 35 , I am getting an error, can you please run the code and tell me what is wrong
![100 %
6 7 8 19 2012 234 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 48 1 2 3 4 45 46 47 48
16
17
18
40
41
42
43
44
|
8
Error List
Entire Solution
Code
abc E0441
C2955
// Print out arrays
for (int i = 0; i, size; i++)
{
Error List Output
}
return 0;
Eint* arrayExpander(int[], int size)
{
cout << arrayPtr[i] << endl;
arrayExpand
Search Online
// function to create new array
{
// ponits to new array with * size X 2, and copied vaules from 1st array with for
int *expanderArray = new int[size * 2];
// copy orginial array into the second array and doblue the size
for (int i = 0; i < size * 2; i++)
(local variable) int *arrayPtr
if (i < size)
{
}
else
x 1 AO
// copies the orignal array
expanderArray[i] = array[i];
//populates the number 0, for the new vaules in exapnder array
expanderArray[i] = 0;
return expanderArray;
2 Errors A 0 Warnings
0 of 1 Message
Description
argument list for class template "std::array" is missing
'std::array': use of class template requires template argument list
Build + IntelliSense](https://content.bartleby.com/qna-images/question/c317763d-1fa7-4bbf-8337-a2804d7c778b/29d29070-a910-4883-ade4-3a99adbefff2/bjpvyxj_thumbnail.png)
![Check Mark](/static/check-mark.png)
Step by stepSolved in 4 steps with 3 images
![Blurred answer](/static/blurred-answer.jpg)
Sample Output should look like this
The given array contains:
1 2 3
The expanded array contains:
1 2 3 0 0 0
Can you review your code and make corrections ?
Sample Output should look like this
The given array contains:
1 2 3
The expanded array contains:
1 2 3 0 0 0
Can you review your code and make corrections ?
- c++ language using addition, not get_sum function with this pseudocode: Function Main Declare Integer Array ages [ ] Declare integer total assign numbers = [ ] assign total = sum(ages) output "Sum: " & total end fucntion sum(Integer Array array) declare integer total declare integer index assign total = 0 for index = 0 to size(array) -1 assign total = total + array[ ] end return integer totalarrow_forwardC#arrow_forwardC Programmingarrow_forward
- AHPA #10:The Secure Array(use C programming)• A programmer that you work with, Peter, is a jerk.• He is responsible for an array [theArray] that is a key part of an importantprogram and he maintains a sum of the array values at location [0] in the array.• He won't give you access to this array; however, your boss has told you that youneed to get input from the user and then place it into the array.• Each evening Peter will scan the code and remove any illegal references to hisarray.• Using pointers, access Peter's array without him knowing it and place threevalues that you got from the user (101, 63, 21) at locations 3, 6, and 9.Recalculate the sum value and update it. ( the output should be same as the picture)arrow_forwardin c++ find the largest and smallest number of any array.arrow_forwardC++, Please add a function where it can display the median, the maximum number, the minimum number, in an array entered by the user. Code: #include<iostream> using namespace std; class Search_Dynamic_Array { public: Search_Dynamic_Array(); int getArrSize(); void getArray(); void setArrsize(int); void setArray(int*); int getSum(int*); private: int arr_size; int arr[]; }; Search_Dynamic_Array::Search_Dynamic_Array() { //ctor } int Search_Dynamic_Array::getArrSize() { return arr_size; } void Search_Dynamic_Array::getArray() { cout << "The elements of the array are: "; for(int i=0; i<arr_size; i++){ cout << arr[i] << " "; } } void Search_Dynamic_Array::setArrsize(int s) { arr_size=s; } void Search_Dynamic_Array::setArray(int a[]) { for(int i=0; i<arr_size; i++){ arr[i]=a[i]; } } int Search_Dynamic_Array::getSum(int a[]) { int sum; for(int i=0; i<arr_size; i++){ sum +=arr[i]; } return sum; } int main() { int s=1, a[s]; cout << "Enter the size of the…arrow_forward
- use c++ Programming language Write a program that creates a two dimensional array initialized with test data. Use any data type you wish . The program should have following functions: .getAverage: This function should accept a two dimensional array as its argument and return the average of each row (each student have their average) and each column (class test average) all the values in the array. .getRowTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row. .getColumnTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column. .getHighestInRow: This function should accept a two…arrow_forwardC code that prints the elements of a 5 * 4 integer array whose elements are generated randomly.arrow_forwardC++ Problem #1: Create a blank 10x10 integer array using constants for the row and column Create a function printArray() that will print every row and column of the array Create a function notFound() that searches each element in the array and returns true if the passed number already exists in the array and false if it does not Create a function fillArray() that will fill the 2 dimensional array with unique random numbers from 0 to 100 inclusive. No cells should have the same number. Use the notFound() function in this function. Print the entire array. Request a column number to print and use a sentinal loop to make sure the row number is valid. If not then request a column number again Create a function printIter() that prints only the passed column using iteration Create a function printRecur() that prints only the passed column using recursion Print the requested column using printIter() and printRecur() Sample output: The array is: Row 0: 41, 85, 72, 38, 80, 69, 65,…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)