Task 1: Write a C++ program in which, read integers from file "data.txt" into an integer array. (Number of data is unknown so allocate memory accordingly). Pass the array as parameter of function which received the array into a pointer in which, deleteall numbers that appears once and return a properly sized array. Display the results on screen from main Make as much functions as needed to fulfill the tasks. Example 1 Sample input: 123313445 Output: 1331344 Example 2 Sample input: 1233 2344 5 Output: 2332344 Note: Order of remaining elements should be same.
Q: Q2(a) (i) Write a C++ program to read a size of an array (D) and then read the array elements from…
A: Given:
Q: 4. State which of the following are TRUE and which are FALSE. If FALSE, explain why. a. If there are…
A: A local static variable is a variable, whose lifetime doesn't stop with a function call where it is…
Q: Question 1 a. What digits are used in the binary number system? b.What digits are used in the…
A: Answer 1) a) Binary number system in mathematics, positional numeral system employing 2 as the…
Q: 4. Given two unsorted arrays of integer numbers, write a function which returns number of elements…
A: Program: Programs contain the general instruction given to the computer to perform certain tasks.…
Q: Display the values of 1D array using for loop? Write a code to print a 3D array? How to print the…
A: As per Bartleby guideline: “Since you have posted a question with multiple sub-parts, we will solve…
Q: 2. Write a C++ program that requests the user to enter 10 floating-point values. The first 5 values…
A: Given:
Q: Task 5: a) Write, compile, and run a program that has a declaration in main() to store the string…
A: Given The answer is given below.
Q: Write a function that accepts an int array and the array’s size as arguments. The function should…
A: We have to write a function that has two arguments: an array and its size. The function creates a…
Q: includes a function to calculate the mode (most frequently occurring score) includes a function to…
A: Note: Since you have again posted multiple independent questions in the same request, we will solve…
Q: 1. Declare an integer pointer and then request memory using malloc() for an array of 2 integers.…
A: Algorithm : Step 1 : declare integer pointer. Step 2 : ask for memory using malloc and create array…
Q: Write a program using c++ that: includes a function that reads integers consisting of students’…
A: A required C++ program is as follows, #include<iostream> //header files for cin/cout…
Q: Part#1: Write a c++ program code to accomplishes the following: 1- Declares an integer data type…
A: Answer
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: Write a C++ program that store radius of 10 circles in an array getting from user. It should…
A: The required C++ code is: #include <iostream> #define PI 3.14#define size 10using namespace…
Q: 23. What is wrong with the following function definition? double * calculate (double a, double b) {…
A: The answer is given below.
Q: 3. Write a C# application that asks the user to search for an item in the array. Input an array of…
A: Given: Write a C# application that asks the user to search for an item in the array. Input an array…
Q: Use the following array of 8 integers to answer the following questions, {7,3,7,7,7,5,2,7} a) You…
A: Algorithm: Start Initialize array with given data Initialize the variable NumbertoMove with 7 Using…
Q: C A)Define a new type called BOOK that consists of an array of 30 characters to store the title of…
A: It is defined as the base for other programming languages, that is why it is known as mother…
Q: Write a function definition for a function named getLast which does the following: 1) Accepts the…
A: In step 2, you will the C++ code.In step 3, you can see the sample output.
Q: This program demonstrates some relations between pointers. What is the output of this program?…
A: Pointer holds the address of another variable
Q: C++ Program - Arrays- Chapter 7 Include the following header files in your program: string, iomanip,…
A: Given:
Q: 3- It is not possible to change the value of the pointer. (True or False). 4- If the following lines…
A: We need to answer questions related to C++ program. *As per the guidelines only 1st 3 question is…
Q: Finish the swap function below using pointers and write the call to swap in the reverse function…
A: C++ Code: // function definition to swap numbersvoid swap(int* n1, int* n2) { int temp; temp =…
Q: : dengue and malaria. Write a complete C++ program to accomplish the following tasks: Task 1:…
A: Task1 and task2 are implemented as follows: //task1 int year[10]; int dengue[10];…
Q: Step #1: Create a function to output the values of an integer array. You will have two parameters:…
A: As per Bartleby guideline: “Since you have posted a question with multiple sub-parts, we will solve…
Q: create a text-based, menu-driven program that allows the user to choose whether to calculate the…
A: Code #include<stdio.h>#include<stdlib.h> #define PI 3.141592653589793238void…
Q: a. Write a statement that declares votes to be pointer of type int. b. Write a C++ code that…
A: int *votes;
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: This program demonstrates some relations between pointers. What is the output of this program?…
A: Actually, program is an executable software that runs on a computer.
Q: Given an integer pointer variable defined as int *ptr; Which of the following statement is invalid?…
A: As per guidelines we can answer only one question for answers of other question please ask…
Q: A data type is called simple if variables of that type can store only one value at a time. A…
A: Hello Student. Warm welcome from my side. Hope you are doing great. I will try my best to answer…
Q: Jse the following array of 8 integers to answer the following questions, (7,3,7,7,7,5,2,7} a) You…
A: Given: To write a C++ program to rearrange the elements of the array and find the sum, product of…
Q: 7-) Write a program that finds the roots of the equation ax?+bx+c=0. The requirements for this…
A: #include <math.h>#include <stdio.h>int main() { double a, b, c, discriminant, root1,…
Q: 5. What is the result of the following function in C++ ? (assume all #include and the unseen code is…
A: Please find the answer below :
Q: Write a function called checkStock to receive a pointer to the address of the first element of the…
A: #include <iostream>#include <iomanip>using namespace std; int checkStock(int *arr, int…
Q: C++ Create a function that will read the following .txt file contents and put them into an array:…
A: Firstly, we need to create a file where c++ files were get stored .Now to open the file using open…
Q: Write a code to pass an integer type array to function and return maximum value from that array…
A: Use header file to create a function Write the program in another file and make sure you include the…
Q: 2/ Write a code that will read two integer numbers and then call a function (swap) to interchange…
A: "Since you have not mention any programming language, so we will write this program in C language."…
Q: Write a function that gets an array as a parameter (address and size) and a number and checks to see…
A: PROGRAM: //Header file #include <stdio.h> //Defining the findnReport() function void…
Q: 2. Write a C++ program that requests the user to enter 10 floating-point values. The first 5 values…
A: According to the Question below the Complete Program: Program Output: After enter 10 float value…
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: have to write a C++ Program to store temperature of 1 city for a week. It shall ask what is unit of…
A: C++ language is a direct descendant of C programming language with additional features such as type…
Q: Write three C++ functions which accepts an array of integers and the size of the array and finds:…
A: Read the inputs. Call sum function to get sum of the integers in the array. Call average function to…
Q: Write a function definition for a function named getPrev which does the following: 1) Accepts the…
A: Answer in step2 Write a function definition for a function named getPrev which does the following:…
Q: 1. single element of an array can be passed to the function? true or false. 2. Array can be…
A: Note: there are multiple questions asked.solving the first three,re-post remaining or specify…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Please fill in the blanks for C, from 1 to 68. /*The program will get the information of each client and print it right back. We could get the information of all clients first, then print them all later for better readability using an array of struct.*/ #include<stdio.h> #include<stdbool.h> #define length 70 //assume there's no names longer than 70 /*It's good practice to add all function headers to the top of the program*/ __1__ __2__ getEmployeeInfo(); __3__ printEmployeeInfo(__4__ __5__ em); __6__ __7__ getClientInfo(__8__ i); __9__ printClientInfo(__10__ __11__ cli, __12__ i); /*Employee struct: all the arrays use the same constant size defined on top name-first, last-(string) title (string) number of clients (integer) number of years working at the company(can take decimal points). */ __13__ employee { __14__ first_name[__15__]; __16__ last_name[__17__]; __18__ title[__19__]; __20__ num_clients; __21__…Question 1a. What digits are used in the binary number system?b.What digits are used in the decimal number system?c.What digits are used in the octal number system?d.What digits are used in the hexadecimal number system? \ Question 2In the following program, there is a call to the print_in_reverse function whichhas the following prototype: void print_in_reverse(float *a, int count); Using pointers, write this function to print the array in reverse order. #include <stdio.h>#define A_SIZE(A) sizeof(A)/sizeof(A[0]) void print_in_reverse(float a[], int count);int main(void) { float values[6] = { 12.1F, 22.2F, 32.3F, 42.4F, 52.5F, 62.6F }; printf("The array in reverse\n"); print_in_reverse(values, A_SIZE(values)); return 0;} Question 3The program below reads two integers. Then a function with the followingprototype is called: void div_rem(int a,…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?…
- C++ Program - Arrays- Chapter 7 Include the following header files in your program: string, iomanip, iostream This program is to have no programmer created functions. Just do everything in main and make sure you comment each step. Also, this program will be expanded in Chapter 9 to use pointers. Create a program which has: 1. The following arrays created: a. an array of double with 5 elements, dArr b. an array of long, lArr, with 7 elements and initialized at the time of creation with the values 100000, 134567, 123456, 9, -234567, -1, 123489 c. a 2 dimensional array of integer, with 3 rows and 5 columns, iArr. d. an array of char with your name initialized in it. Big enough for 30 typable characters, sName. 2. define 3 variables, , cnt1 and cnt2 (short data types) as general purpose counters and a long double total 3. define 1 long variable called highest 4. a for loop to put a random number into each of the elements of the array of double, dArr. Use rand() and seed a random starting…6. 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. thankswrite C++ statements that perform the specified task. Assume that unsigned integers are stored in four bytes and that the starting address of the built-in array is at location 1002500 in memory. " Write two separate statements that assign the starting address of built-in array values to pointer variable vPtr ."
- 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?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].You are supposed to manage records of multiple circles. Write a C++ program that store radius of 10 circles in an array getting from user. It should calculate areas of all circles and store result in new arrays. Your program shall have following functions:a. You are required to write a function to display areas of all circles which are greater than 200.It shall also display sum of these areas. This function shall accept array of areas as a parameter. Function shall have void return type.b. You also have to function to displays count of circles having area less than 200. In this function array of areas of circle shall be passed as parameter and shall return count of circle with area less than 200.Note: You shall give functions appropriate names.
- 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 30Please use C Programming how to write a function definition to match given function interference, the code does not have to work, it is just for my understanding. int save_array(const char *filename, const int *a, int n );//REQUIRES: filename points to the start of a string.// n>0 and element a[0]....a[n-1] exist.// PROMISE:// if the test file with name filename can be successfully opened,// the value of n is printed to the file, followed by the values of // a[0]....a[n-1], one number per line // the return value is 0 for success, 1 for failure to open the file,// and 2 if an error is detected closing the fileQuestion 2In the following program, there is a call to the print_in_reverse function whichhas the following prototype: void print_in_reverse(float *a, int count); Using pointers, write this function to print the array in reverse order. #include <stdio.h>#define A_SIZE(A) sizeof(A)/sizeof(A[0]) void print_in_reverse(float a[], int count);int main(void) { float values[6] = { 12.1F, 22.2F, 32.3F, 42.4F, 52.5F, 62.6F }; printf("The array in reverse\n"); print_in_reverse(values, A_SIZE(values)); return 0;}