Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program to remove unnecessary blanks from a text file. Your program should read the text file and copy it to another text file, but whenever more than one blank occurs consecutively, only one blank should be copied to the second file. The second file should be identical to the first file, except that all consecutive blanks have been replaced by a single blank.


Write a program that initialises a vector with the following string values: “what” “book” “is” “that” “you” “are” “reading”. Display the contents of the vector on the screen to the user as a question and read in the name of the book the user is reading (you can decide what it will be). Have the program add the name of the book to the vector, word by word. For example, if I am reading “How to learn C++”, the program should add the words, “How” “to” “learn” “C++”, one by one to the vector. Display the new vector. 


Write C++ statements to do the following: (7)

(i) Define a pointer type int_ptr for pointer variables that contain pointers to int variables. (ii) Declare p2 to be a pointer to an int.

(iii) Obtain an integer value nrElements from the user indicating the number of elements to allocate.

(iv) Dynamically allocate an array of nrElements integers and store its address in p2.

(v) Declare an int array a with 500 elements.

(vi) Assume p2 has been initialized and copy the elements of p2 one by one to the corresponding elements in a.

(vii) Free the memory allocated to the variable that p2 is pointing to.


For each of the following, write a single C++ statement that performs the identified task. (7)

(i) Declare two variables fPtr1 and fPtr2 to be pointers to objects of type double.

(ii) Create a dynamic variable to which fPtr1 points.

(iii) If the pointer fPtr2 is undefined (i.e. it does not point to any variable), let it point to the same variable that fPtr1 points to.

(iv) Print the address of the object pointed to by fPtr1.

(v) Print the value of the object pointed to by fPtr2.

(vi) Release the memory occupied by the dynamic variable to which fPtr1 points.

(vii) Assign null values to the pointers fPtr1 and fPtr2


You are given an array of numbers as input: [10,20,10,40,50,45,30,70,5,20,45] and a target value: 50. You are required to find pairs of elements (indices of two numbers) from the given array whose sum equals a specific target number. Your solution should not use the same element twice, thus it must be a single solution for each input



1.1 Write a Python class that defines a function to find pairs which takes 2 parameters (input array and target value) and returns a list of pairs whose sum is equal to target given above. You are required to print the list of pairs and state how many pairs if found. Your solution should call the function to find pairs, then return a list of pairs.



1.2 Given the input array nums in 1.1 above. Write a second program to find a set of good pairs from that input array nums. Here a pair (i,j) is said to be a good pair if nums[i] is the same as nums[j] and i < j. You are required to display an array of good pairs indices and the number of good pairs.

How to find largest number inn list in python


Given a list of integers, write a program to print the sum of all prime numbers in the list of integers.


Note: one is neither prime nor composite number


Using the pass statement

how to get a input here ! example ! 2 4 5 6 7 8 2 4 5 2 3 8 how to get it?


• Basic Looping Task:


Based on the user's integer input (0-9).


Display sets of "*"



Example:



Enter a number: 6



******




Write python code to read and write data to a file named "university.txt" with the following criteria:






- Change the "university hymn" in "university.txt" file to your favorite song





- Write "Submitted by: Firstname Lastname






LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS