Q1. Write a program to do the following : (1) Declare an array a of size 10 and three pointer variables p, q, and v. (2) Write a loop to fill array a with values 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 (3) write following statement: p= &a[2]; q = &a[5]; i = *q - *p; cout<
Q: 5. Assume that an integer array m is defined by the following statements: int m[2][5]={{1,8,7,6,10),…
A:
Q: Write a program to store the above 3 class scores in Jagged Array by initialing all these values ,…
A: A Jagged Array is an array which is a two dimensional array where the columns changes from one row…
Q: write C++ statements that perform the specified task. Assume that unsigned integers are stored in…
A: Given : write C++ statements that perform the specified task. Assume that unsigned integers are…
Q: Q1. Write a program to enter 10 numbers using keyboard and put them in an array. Now generate…
A: Note:- Since you have not specified the programming choice, we will be solving this question in…
Q: 5. Write a program to pass an integer array of 10 elements to a function which returns the same…
A: 1) read the elements into the array 2) print the elements before sorting 3)call the function which…
Q: Hello, I am having trouble with this homework question for my C++ course. Pointer arithmetic.…
A: Given: Hello, I am having trouble with this homework question for my C++ course. Pointer…
Q: Q1.Write a C++ program that declares three arrays, Markl, Mark2, Result. and carries out the…
A: Step 1:- The array is defined as a collection of similar types of data. For Example int A[2] In the…
Q: Q A: What is the starting index of ary Q B: What is the last index of ary Q C: Write statement to…
A: Starting index of ary:- 0
Q: Write a VB.NET program to search an element in an array.
A: An array holds elements of the same type as a sequential list. An array can be defined using a Dim…
Q: 3. Write a program C++ which takes 2 arrays of 10 integers each a and b. c is an array with 20…
A: Required:
Q: Write a function that finds the smallest element in an array of double values using the following…
A: Note: Here you didn't mention any programming language So we are using the C++ programming language…
Q: 3. Write a program C++ which takes 2 arrays of 10 integers each a and b. c is an array with 20…
A: the code is an given below :
Q: Complete the following function definition to recursively print the index of a unique value in an…
A: we have to write all code in the blanks
Q: W310 6025 45 Consider the block of code and the function below then find the first two and last two…
A: (a) First two (77,0) Last two(9,4)
Q: Program 3.8.2: Write a program to find the sum of an array Arr by passing an array to a function…
A: A pointer is a special variable that is used to store the address of a variable or the address of an…
Q: 1. Given the following array declaration: int A [3 ][2 ]={{13, -23}, {3, 80} ,{91,55} }; declare…
A: I give the code in CPP along with output and code screenshot
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: 1. Write a program that take an Alphabet C (C can be uppercase or lowercase) as input and print all…
A: i give this question answer in next step
Q: return
A: A function which will find the average of all elements of an array of integers. float average(int…
Q: 2. Write the following program: If the last digit of your unique real Kean ID is even, implement a…
A: Algorithm: Start Using System.nanoTime() finding begin time at the start of the program Read ID…
Q: Given the following array data: int data[l0]={20,79,23,65,49,4, 60,13,67,82); Based on the above…
A: Program Description: Given the following array data: int data[10]={20, 79, 23, 65, 49, 4, 60, 13,…
Q: Write one or more C++ statements that perform the following tasks: а) Define a constant integer…
A: Kindly Note: As per our company guidelines we are supposed to answer only first 3 sub-parts. Kindly…
Q: Q1: Write a function to swap the elements above and below the first diagonal of a two-dimensional…
A: We need to write a C++ program that swaps the elements above and below the first diagonal of a 2-D…
Q: 5. Write a program that includes the following: a) Define a character array and initialize it with…
A: #include<stdio.h>int main(){ char s[]={'H','E','L','L','O'}; // define and initializing a…
Q: 7. Write a program that performs the following operations: a) (i) Define a structure named…
A: PROGRAM CODE: #include<iostream>using namespace std;// define a structure as name…
Q: Q#2(a) Find the error in each of the following program segments. Assume int *zPtr; // zPtr will…
A: Note - As per the guidelines we are only allowed to answer 1 question with 3 sub parts at a time.…
Q: //Write the assembly for the following loop # // Use indexed array access (no pointers) # const int…
A: here, I have to write assembly code for the question.
Q: In C++ Please Take number n from user and create an array A of random integers of size n. The size…
A: PROGRAM STRUCTURE: Include the required header files. Start the definition of the function to swap…
Q: Q4: write a program using array name as a pointer to read the elements of the one dimensional array…
A: Given: Position to delete array value and display them as a output
Q: Consider a two-by-three integer array t. h) Write a series of statements that initializes each…
A: Here I have first of all created an integer type 2D array of 2 rows and 3 columns. Now I have used a…
Q: 1. A.Write a program for displaying the string declared in an array, str[] = "hello",in reverse…
A: 1 (A). Code: #include <bits/stdc++.h>using namespace std; void reverse(char* str){ int l, i;…
Q: Write a function that finds the smallest element in an array of double values using the following…
A: Here is the program in C++: #include <iostream> using namespace std; double min(double…
Q: int ary[] = {5, 9, 4, 2, 6, 7, 8, 4}; Q A: What is the starting index of ary Q B: What is the…
A: An array is a data structure consisting of a collection of elements which are identified by at…
Q: 1. Write function that swaps the values of two integer variables a. using pass by value and b. pass…
A: 1. a. The function to swap two integers by passing the values is shown below. void swap(int x, int…
Q: Write one or more C++ statements that perform the following tasks: a) Define a constant integer…
A: It is asking for the syntax of the C++ to do the task. I am assuming the name is "John Doe" which is…
Q: Declare and initiate a float type array of A[ ]. then create another float type array B[ ].find the…
A: Note :- As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: Problems: 1. Write a program to define an array of size 10, ask the user to enter the array…
A: Note: Since no programming language is mentioned, the program has been done and provided in Java…
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: Create a function that takes two "sorted" arrays of numbers and returns an array of numbers which…
A: 1. Create a method that accepts 2 array arguments 2. create the common array 3. Iterate for loop on…
Q: need help c++ Write the specified code: 1. Initialize an dynamic integer array of size 5 with the…
A: Dear learner, hope you are doing well . I will try my best to answer this question. Thank You!!
Q: 1 äböi In the following program, the output value is (3). #include void main( ) { int…
A: Answer: When we run the given program it will give the output 3 #include <iostream> using…
Q: Question # 10: Write a program to print the following output: BBBBBBBBB BBBBBBB BBBBB BBB B Question…
A: Note: Here you asked three independent questions so I'm going to answer the only 1st question.…
Q: Write program to read in the element value of X(12), then add the value ofD to become the 5th…
A: Given: Write program to read in the element value of X(12), then add the value of D to become the…
Q: ) For each of the following, write C++ statements that perform the specified task. a) Declare a…
A: Actually, memory is a used to stores the data.
Q: Implement Exercise 8-13 using single-dimensional parallel arrays. (8-13: Write a program to…
A: EXPLANATION: - void readFile(ifstream& infile,string names[],double scores[][5],int& n): -…
Step by step
Solved in 4 steps with 2 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.1. A.Write a program for displaying the string declared in an array, str[] = "hello",in reverse order of characters using pointers. B.Write a program for initializing from another vector that will output 10 20 305. Write a function which will find the average of all elements of an array of integers. Pass an array and a dimension (the number of elements), and return the value of the average as a float ( the return value). Test this function in the main program with the array: 5, 7, 3, 5, 6, 4.
- 2) For each of the following, write C++ statements that perform the specified task.a) Declare a built-in array of type unsigned int called values with five elements, andinitialize the elements to the even integers from 2 to 10.b) Declare a pointer vPtr that points to a variable of type unsigned int.c) Write two separate statements that assign the starting address of array values to pointervariable vPtr.d) Use a for statement to print the elements of array values using pointer/offset notation.e) Refer to the fifth element of values using pointer subscript notation.f) Assume that unsigned integers are stored in two bytes and that the starting address of thearray is at location 1002500 in memory.• If vPtr points to the first element of array values, then what address is referenced byvPtr + 3? (manually calculate)• What value is stored at that location?C++ Implement Exercise 8-13 using single-dimensional parallel arrays. (8-13: Write a program to calculate students’ average test scores and their grades. Your program must contain at least the following functions: a function to read and store data into two arrays, a function to calculate the average test score and grade, and a function to output the results. Have your program also output the class average.) Create a text file with the following data to test your code. Read the following data from this text file: Johnson 85 83 77 91 76Aniston 80 90 95 93 48Cooper 78 81 11 90 73Gupta 92 83 30 69 87Blair 23 45 96 38 59Clark 60 85 45 39 67Kennedy 77 31 52 74 83Bronson 93 94 89 77 97Sunny 79 85 28 93 82Smith 85 72 49 75 63 Using the data above your output should be: (image below)1. Given the following array declaration: int A [3 ][2 ]={{13, -23}, {3, 80} ,{91,55} }; declare a pointer that points to A[2][0]? Answer:
- Create two dynamic arrays A and B with random numbers.a) Merge B in array A calling a function by reference.b) Delete the Prime numbers from the merged array A calling a function by pointer.c) Print the Array A in ascending order.You have to use only two Arrays A and B throughout the code. Be carefulabout memory leakage.Example:A= [20, 30, 5, 7, 19]B= [19, 10, 15, 11, 17, 25] a) After merging B in A, the merged Array A will look like-A= [20, 30, 5, 7, 19, 19, 10, 15, 11, 17, 25] b) After deleting prime numbers the merged Array would look like-A= [20, 30, 10, 15, 25] c) Finally print the merged array in ascending orderA= [10, 15, 20, 30, 25] In C++ PleaseQ. (a)Write a function that finds and returns the maximum value in a 1D integer array. (b)Write a function that finds and returns average of the elements in an array. (c)Write a function that Bubble sorts the array in ascending order and displays the array in main.Code in C# After the final exam, the following information is observed about securing “A” grade PF class id 01 gets 4 A grades with scores 87 88 89 87 PF class id 02 gets 2 A grades with scores 90 87 PF class id 03 gets 3 A grades with scores 91 89 87 Write a program to store the above 3 class scores in Jagged Array by initialing all these values , then program will print the following information on screen. 1: Student with highest marks in each class 2: Student with highest marks in all 3 classes
- 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].c++ 6. Write a program which will prompt the user to enter an array of 12 characters. The program should then print the array, and then print the array again, but this time as a 4 colums by 3 rows array.Complete the following function definition to recursively print the index of a unique value in an array or -1 if the value is not found:1 int getIndex(int *a, int s, int v) {2 if( ) { // if no values are found3 4 }5 if(a[s-1] == v) { // if a value is found6 7 }8 return getIndex( ); // recurse to check next value9 }Hint:Recurse through the array by counting down from size. 1. Complete the one line of code for line 2:2. Write one line of code for line 3:3. Write one line of code for line 6:4. Complete the one line of code for line 8: please send an atom code. not other software