Write a function that takes an array of ints and its size as arguments. It should create a new array that is the same size as the argument. It should set the values in the new array by adding 10 to each element in the original array. The function should return a pointer to the new array. (Make sure you use dynamic memory allocation)
Q: Write a function, ReadFile(), that reads the content of the provided text file “Message.txt” and…
A: Explanation: we are going to use two pointers, one that points at the start of the string and the…
Q: 1. Write an Arduino program that globally declares an array of size fifteen. The array data type is…
A: According to the information given :- I used Arduino UNO R3 to test the code it is working fine.
Q: C++ Write a function named averageScores that takes in a float array of scores and the array’s size…
A: C++ Write a function named averageScores that takes in a float array of scores and the array’s size…
Q: Write a function that accepts an int array and the array’s size as arguments. Thefunction should…
A: Array : The array is defined as the collection of elements that is again accessed by the index…
Q: Suppose that you create a pointer as follows Int *p; Which line removes that pointer
A: Please find the answer below :
Q: Write a functionvoi d switchEnds(in t *array, i nt size);that is passed the address of the beginning…
A: Answer: Program plan: Declare a function named switch Ends(). Create a main method. Create an array…
Q: Write a function that computes the average of the items in the array. The function name is "func1"…
A: .386.model flat,stdcall.stack 4096 ExitProcess PROTO,deExitCode:DWORD .data array SDWORD…
Q: Using “Def” keyword write a function that sorts the given array (The function name will be…
A: def keyword is used to define any function in Python sort() is used to return the sorted list mix()…
Q: Write a function that search an item in the array -ubmission (1) data array DWORD 1@h,20h, 30h, 40h,…
A: Answer: I have given answer in the handwritten format.
Q: Write a function called double getAverage(int *array, int SIZE), where it accept the array as…
A: Question has asked to write a function in C++ called double getAverage(int *array, int SIZE)…
Q: Write a function void switchEnds(int *array, int size);that is passed the address of the beginning…
A: Function: void exchange(int *p, int *q){int temp = *p;*p = *q;*q = temp;}
Q: Write a program named expander.cpp. The program should ask a user for five (specified this number…
A: Here I have defined the function expandArray(). In this function, I have declared a new array twice…
Q: Write a function that takes an int array as an input and finds the first and second odd numbers. You…
A: Code #include<stdio.h> void getOdd(int *arr,int n,int *first_odd,int *second_odd,int*…
Q: 1. Create three arrays of 20 integers each. 2. Fill in two arrays with data, leaving the third…
A: Algorithm: 1.Function receiving the 3 arrays. By default arrays are passed by reference 2.Assing…
Q: Write a program that dynamically allocates an array large enough to hold a user-defined number of…
A: Note: As programming language is not mentioned. So, used C++ language to implement the task.…
Q: This exercise give you practice working with a two-dimensional array. the Example 7.14 on…
A: #include<iostream>#include<fstream>using namespace std;int loadArray(int grade[4][3]){…
Q: Which of the following statements is NOT correct? Select one: O a. You can define const array…
A: Yes, we can define const array parameter in a function to prevent it from being changed.
Q: 1. Write a function that reads real (fractional) numbers , X1,X2,., XN from the keyboar into an…
A: C++ code :- #include <iostream>#include<cmath> using namespace std; int main() {…
Q: Write the function that prints a 23 numbered array sent into it with the main function.(Please…
A: As the language is not specified answer is written in c++ rand() is the function used to…
Q: Declare an array of type doable having size 10. write input to initialize the array, write another…
A: Code in c: As you have not mentioned the coding language i am providing the code in c: #include…
Q: Write the function fill which fills an array with a given value. Return the modified array. (Hint:…
A: 1)create a new array of size len 2) iterate over array 3) Put new value at each index 4) return…
Q: Write a function that will accept two char arrays and check if these are same or not. Example 1:…
A: /*C Program to define function compare with accespts two arrays and check if they are same or not*/…
Q: Write the array and its contents after having executed the following functions If the function call…
A: Program import java.util.*; class Scoreboard{ int id; String name; public Scoreboard(String…
Q: Declare an array of type doable having size 10. write input to initialize the array, write another…
A: #include <iostream> using namespace std; //this function will take array pointer and print…
Q: Write the function that returns the total number of the searched value according to the 1000 sized…
A: C++ program to write the function that returns the total number of the searched value according to…
Q: Write a function that receives, as arguments, a pointer to a double array, as well as the number of…
A: Note: Programming language is missing in the question. So we will answer this program in C++…
Q: Write a function called Findlt(). This function will reeoive z[1, a float array; size, an integer…
A: Explanation If carefully follow the instructions in question program would look like this, #include…
Q: Write a program that dynamically allocates an array large enough to hold a user defined number of…
A: #include <iostream>using namespace std; void sortArray(int arr[], int n) { for (int i = 0;…
Q: 2. Write a program that takes an array large enough to hold a user-defined number of test scores.…
A: As per our policy, we are answering the first question. Kindly submit the remaining question…
Q: Write a function int wrong(char key).char results[) The function will be used to grade…
A: #include <iostream> using namespace std; int wrong(char key[], char result[]){ int i,…
Q: Write a function int mark(char key[],char answer(]) The function will be used to grade…
A: Given:
Q: Write a function that takes an int array as an input and finds the first and second odd numbers. You…
A: C++ Program for above : #include <iostream> using namespace std; //function to find first…
Q: 11. Write a function that returns the minimum, maximum and the average value of an array passed as a…
A: 11.this function takes as array elements and that returns minimum maximum and average elements in…
Q: 1- Write a user-defined function that accepts an array of integers. The function should generate the…
A: Program;- #include <stdio.h>void calculate(int arr1[],int n){ float arr2[20]; float…
Q: Create two dynamic arrays A and B with random numbers. a) Merge B in array A calling a function by…
A: rand() generate random numbers in c++ rand() % 10 will generate values from 0-9 rand() % 100 will…
Q: 4) Write a function named "rotate_right" that takes as its arguments the following: (1) an array of…
A: According to the question below the solution: Output:
Q: Write a function that will receive a pointer to the address of the first element of the array. Read…
A: The program will be created as follows: Include header files iostream and fstream. Define a…
Q: Write a function that determines the average of the values in an array. In the main() function…
A: Required: Write a function that determines the average of the values in an array. In the main()…
Q: Part 1 Write a function that will receive a pointer to the address of the first element of the…
A: Pointers : A pointer is a variable whose value is the address of another variable, i.e., direct…
Q: Write a function that computes the maximum of the items in the array. The function name is "func1"…
A: The code is below:
Q: Create two dynamic arrays A and B with random numbers. a) Merge B in array A calling a function by…
A:
Q: (a) Write a function number() that receives a string as its argument and returns a code number…
A: The character array is a collection of characters stored in a linear array data structure. The…
Q: Write a function which will accept A and B (provided by the user). Write anonymous function which…
A: import required modules like numpy,matplotlib.pyplot,math ask user for inputs for values A,B by…
Q: Write a void function that reads a file “a:data.txt” with up to 35 student ids, names and final…
A: Program: #include<iostream> #include<fstream> #include<string> using namespace…
Q: Declare two dynamic arrays of length 5. Initialize one of them from user input. Make the second one…
A: Note: we are only allowed to solve one question in one post. I am solving the first on here. To get…
Q: Write a function that will receive a pointer to the address of the first element of the array. Read…
A: #include <iostream>#include <fstream>#include <cstdlib>#include…
Write a function that takes an array of ints and its size as arguments. It should create a new array that is the same size as the argument. It should set the values in the new array by adding 10 to each element in the original array. The function should return a pointer to the new array. (Make sure you use dynamic memory allocation)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- 1. Write a function called void swap with two parameters, which will receive the addressof x and y as pointer. The function should swap the value of x and y only if x is larger thany. Print the value of x and y after the function call. 2. Write a function called double getAverage(int *array, int SIZE), whereit accept the array as pointer, and return the average of the array. Print the returnedvalue from this function. Always use *array rather than subscript to access the arrayvalue.Write a code that contains a function which finds the minimum element of an array of unsigned numbers. The function has the following features: - it takes the address of the array as the first argument - it takes the size of the array as the second argument - it returns the minimum element then store the returned element in RAM6. Write a swap function, that swaps the values of two variables in main, but usepointers instead of reference parameters.7. Write a function that takes an array of ints and its size as arguments. It shouldcreate a new array that is the same size as the argument. It should set the values inthe new array by adding 10 to each element in the original array. The functionshould return a pointer to the new array. (Make sure you use dynamic memoryallocation) can i get answers for this two sub parts. thanks
- 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 displays the values of the new expanded array, one value per line. You may assume that the file data has at least N values. There are no prompts for the integer and no labels for the expanded reversed array that is printed out. If the integer read in from standard input exceeds 50 or is less than 0 the program terminates silently.Write a function that uses a pointer to copy an array of size n. The data type of the array should be double. You can take input from the user, or you can use random variables. 6. Write a function that will receive a pointer to an array of floats of length n. The function will return the address of the maximum value in the array. need the solve in c++ languageWrite a program that asks the user to input a series of numbers. Theprogram should read the numbers into an array and then does the following:a) Write a function that will find the average value in the array.b) Write a function that will find the mode value in the array.c) Write a function that will display the sorted array of numbers from maximum tominimum.d) Write a function that will search the array for a specific value.e) Write a function that will display all of this information to the user in a nice format.You should submit the flowchart and the python code for this assignment
- Finish the swap function below using pointers and write the call to swap in the reverse function using the address of the array positions array[i] and array[size-i-1].using pointers. DON'T FORGET TO DECLARE THE PARAMETERS in the function. (Hint: if you can't figure it out with pointers, do it with the references #include <iostream>using namespace std; // Function to swap two ints using pointers// @param pointer to an int// @param pointer to an intvoid swap( ) {// TODO: Add code that swaps two integers using pointers } // Function to reverse arrayvoid reverse(int a[], int size) {for (int i = 0; i < size/2; i++) {// TODO: write the call to swap in the reverse function using the // address of the array positions array[i] and array[size-i-1].Write the code that dynamically allocates memory for an array of 10 integers and assigns its address to the pointer ptr. After that use that pointer to access the array and store on it the powers of two then display the content of the array on the screen. The output should be: 2 4 6 8 16 32 128 256 512 1024. Note: You can use the pow() function. This function takes two arguements and returns the result of the first argument raised to the power of the second arguement.It's important to note that the name of an array by itself is really a pointer to the first element of the array. Therefore passing an array to function is simple since you can just specify the name of the array. Are these statements true?
- 1. single element of an array can be passed to the function? true or false. 2. Array can be declared as constant? true or false. 3. which of the following gives the memory address of the first element in array x? a. X b. X[0] c. X{0} d. X_0 e. X(0) 4. The index of the last element of array X whose size is S? a. S+1 b. S-1 c. 0 d.1000 e. S 5. Assume you have the following declarations const int MAX = 1000;double A[MAX];which of the following sentences is incorrect? a. The assingnment statement MAX = 1000 is mandatory. b. we can store up to 1000 values in the mandatory. c we cannot change the size of the array A during the runtime. d. all values in the array are set to ZERO's (0) e. all above sentences are correct. 6. The only difference between char array and string is that, the string ends with '\0'? true or false. 7. Index of an array can be of type integer or double, since both deals with the digits? True or False 8. Which definition describes the term Array precisely?…Write a function that receives, as arguments, a pointer to a double array, as well as the number of elements in the array (int). The function must use pointer operations (no block notation such as arr[i]) and calculate the standard deviation of the elements in the array. The function returns the standard deviation to the calling statement. Due to possible rounding or floating-point arithmetic errors, round the result to 4 decimal places. Use the formula below. Each summation can be done with a for-loop. To calculate the square root you may use the <math.h> header file. You may use the following code: float data[] = {11.2, 2.4, 3.13, 16.4, 5.8, 9.22, 4.9, 10.5, 6.5, 2.99}; int N = sizeof(data) / sizeof(float);A pointer variable can contain a pointer to a single variable, a pointer to an array, nullptr, or a random value. Write code that creates and sets four pointer variables a, b, c, and d to show each of these possibilities.