6.24 LAB: Calculate average Complete the CalcAverage() function that has an integer vector parameter and returns the average value of the elements in the vector as a double. Ex: If the input vector is: 1 2 3 4 5 then the returned average will be: 3.0
Q: You are a software engineering manager and your team proposes that model-driven engineering should…
A: The factors that you have to consider when making this decision includes: 1. The expertise of the…
Q: Please develop PL/SQL program that asks for a radius of a circle. After user enters a radius number,…
A: Syntax to implement IF statement: IF condition THEN statements; ELSEIF condition THEN…
Q: In a system with 42-bit virtual addresses and 64GB of physical memory what is the size of the…
A:
Q: A micro instruction format has micro operation field which is divided into 2 subfields F1 and F2,…
A: Logic , if there are n micro- operation then we can represent it in form of 2n where n will…
Q: 4. Calculate the perceptron network if there are 3 inputs x,-1.7, x,-5.9, x₂-3 and b= -1.8. Synaptic…
A: Perceptron network: A perceptron is a neural network entity that carries out specific simulations…
Q: Name at least three tasks performed by the WinMain (startup) procedure.
A: WinMain Procedure WinMain is the name of the primary entry point for every Windows application.…
Q: Explain why TIME. WAIT is a somewhat more serious problem if the server initiates the close than if…
A: In comparison to the client, TIME_WAIT has problems getting the server into a close condition. The…
Q: Deadlock A) A system has four processes and five resources. The Claim matrix, current Allocation…
A:
Q: Describe what will happen for the following scenario when Wait/Die is adopted. What will happen when…
A: According to the information given:- We have to follow the instruction and describe what will hap,…
Q: Consult Request for Comments 793 to find out how TCP is supposed to respond if a FIN or an RST…
A:
Q: Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack".…
A: Algorithm: Set prefixes to 'JKLMNOPQ' Set suffix to 'ack' Iterate for loop for letter If the…
Q: Output For each graph, produce a line listing the weak vertices ordered from least to greatest.…
A: #include<iostream> using namespace std; //max no of nodes const int n_max=20; int main(){…
Q: You have been asked to test a method called 'catWhiteSpace' in a 'Paragraph' object that, within the…
A: The given scenario involves testing a method named "catWhiteSpace" in a "Paragraph" object that…
Q: data and on. Nowadays, have targeted organisations that deal with confidential consumer information…
A: SUMMARY Data breach definition: a data breach exposes confidential, sensitive or proprietary…
Q: bits required transmitting the data (ii) positions of redundant bits (iii) total code length (iv)…
A: The answer is
Q: Draw the UML diagram for the class. Implement the class. Write a test program that creates an…
A: The getMonthlyInterest() method should be used to obtain monthly interest rather than interest rate.…
Q: A computer with 192.168.2.1 is not in the same network since it's "network" part is different, it's…
A: Introduction: Below describe computer with 192.168.2.1 is not in the same network since it's…
Q: Question #7. SORTED LIST NOT UNSORTED C++ The specifications for the Sorted List ADT state that the…
A: The, code has given below:
Q: a) Consider the (7,4) hamming code with data word 1111 and evaluate the 7-bt composite code word…
A: Introduction Hamming code is utilized to identify errors. Here the codeword has a place with even…
Q: Find out the generic format for TCP header options from Request for Comments 793. (a) Outline a…
A: TCP Header TCP header holds several information fields with the host address of source and…
Q: Butwhat happens if we write an expression that mixes an int with a float?
A: Data Type: A data type, often known as type, is a characteristic of data that informs the compiler…
Q: Develop a sequence diagram showing the interactions involved when a student registers for a course…
A: A sequence diagram is a form of interaction diagram because it illustrates the interactions between…
Q: Suppose two hosts A and B are connected via a router R. The A-R link has infinite bandwidth; the R-B…
A:
Q: Given the grammar G with following production rules: ? → ?|??|?? determine whether the following…
A: According to the information given:- determine whether the following strings can be generated by the…
Q: b) Design a dynamic array of 25 elements. Fill them using rand function of two digits. Then take a…
A: CODE: #include <stdio.h>#include <stdlib.h> int main(){int* ptr;int i; // Dynamically…
Q: Write a C++ program that reads strings until "QUIT" input, which then displays all strings in the…
A: I have provided C++ CODE along with CODE SCREENSHOT and also provided OUTPUT SCREENSHOT------…
Q: What do you think will happen when the operands to the integer divisionor remainder operations are…
A: Lets see the solution.
Q: Describe a protocol combining the sliding window algorithm with selective ACKS. Your protocol should…
A:
Q: Name at least three tasks performed by the WinMain (startup) procedure.
A: The question has been answered in step2
Q: Explain why design conflicts might arise when designing an architecture for which both availability…
A:
Q: What plan did the reboot project have for ISEE-3? Did the plan work ?
A: ISEE-3 gathered information about particles flowing from the sun. These particles also known as…
Q: Which of the following is a best security practice to protect your credentials when browsing the…
A: The correct 2 answers is:- C) Turn on "InPrivate Browsing" before starting your session And D)…
Q: In Java, please solve and don't copy from wrong answers. I need the JAVA CODE, not an answer like…
A: Here is the java program implementation of above problem. See below step for code.
Q: Write a program that draws 5 dice on the screen depicting a straight (1, 2,3, 4, 5 or 2, 3, 4, 5,…
A: Lets see the solution.
Q: In GSM, a "TDMA frame" is composed of eight distinct time slots. Each GSM time slot is 577 s…
A: GSM(Global for Mobile communication ) Global System for Mobile Communications, or GSM. GSM is a…
Q: 2) A BMI Calculator: the body mass index (BMI) is a measure used to determine whether a person is…
A: import java.util.Scanner; public class Test{ public static void main(String[] args) { Scanner sc =…
Q: explan russias cyber attack in ukrain -impacts -counter mesures -preventions
A: An assault that is launched by cybercriminals and uses one or more computers to attack a single or…
Q: Suppose you are downloading a large file over a 3-KBps phone link. Your software displays an…
A:
Q: This program will ask the user to input a number (suppose num). And that outputs the first num'th…
A: Since no is given in the problem. I am using c++ language. See below steps for code:
Q: Write a c++ code that takes a 4-digit binary number as an input and converts it into decimal then…
A: The following steps need to be taken for the given program: Ask the user an integer Check if it is…
Q: The telephone system uses geographical Why do you think this wasn't addressing. adopted as a matter…
A:
Q: (a) Construct an appropriate SQL query (Create Table) for the following table:- i. Member ii. Make
A: NOTE - I have Oracle as a database to create and store the table. I have created the table Member…
Q: Which of the following is not a built-in operation?a)+ b)% c) abs () d) sqrtO
A: Explanation The functions whose functionality is predefined in Python are referred to as built-in…
Q: Write a program that accepts two points (see previous problem) and de-termines the distance between…
A: We need to find the distance between two points where we accept the x and y of every point then we…
Q: Consider the following network. Here, Distance vector routing is being used. 00 8 X 6 6 12 y 3 W st…
A: The question is based on distance vector routing algorithm.
Q: You are a software engineering manager and your team proposes that model-driven engineering should…
A: Software development and software engineering:- Software development and software engineering…
Q: elop a sequence diagram showing the interactions involved lent registers for a course in a…
A: Introduction: Below Develop a sequence diagram showing the interactions involved when a student…
Q: Write a Python code to draw the given shape. 100 30 40 30 70 30
A: import turtle b = turtle.Turtle() b.fillcolor('blue') b.begin_fill() b.fd(100) b.rt(90)…
Q: 1. Scalability is one of the quality attributes of a software system. Explain five tactics of…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: Write a c++ code that takes a 4-digit binary number as an input and converts it into decimal then…
A: Here is c++ program to implement. See below steps.
C++ help please
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Declare a vector of 15 doubles. Using a loop, set all the elements of your vector to 140.041. Write a function named print Vector that returns nothing and takes by constant reference a vector of doubles. The function should print every element of the vector, followed by a newline. Use this function to print out your vector from Assignment 1 above. Using the at() function, change the value of the first two elements to -1.0. Using the push_back () function to add two new elements at the end of the vector with values -10.3 and -20.3. Now use the sort () function on the vector. Using your function from Assignment 2, print the vector. Write a program that takes keyboard input from a user and puts what they type into a string. Print out the number of characters they just typed. Change the first character of the string to 'x'. Now append "<- you typed this!" to the string. Now print the modified string with cout. Caign Declare a vector of 5 strings. In a loop, read from the keyboard into each…3. Use two vectors and make them into one. Use the following vectors:Vector#1 {1, 1, 5, -3, 0}Vector#2 {9,7,2}Return a vector containing 1, 1, 5, -3, 0, 9, 7, 2 (in that order)Class Average GPA Create a program that dynamically creates a vector whose size depends on the user's preference. Pass the vector to a CalculateAverage function that is responsible for computing the average GPA of the given vector of GPAs. CalculateAverage Implement a function called CalculateAverage in calculate_avg.cc that calculates the average of a double vector and returns that average. CalculateAverage() will have one parameter, a std::vector<double>& referring to the vector. When the vector size is greater than 0, the function should calculate the average GPA from the given vector of grades. However, when the size of the vector is 0, then the function should return 0. main The main function has mostly been built for you. It is your task to: Construct a double vector based on the inputted class size. Store each student's GPAs into the vector. Pass the vector as input to CalculateAverage to compute the average GPA of the class. Display the students' average GPA. Read…
- 1-Define a vector V with a dimension of 1*25 and fill it with random integers in the range (10,35). 2-Find the sum of the last five even elements in V. 3-Swap the last by the middle element of the vector V. 4-Delete the middle number and elements around middle element in the vector V. Delete only two elements around the middle element. use matlab50. Create a vector variable vec; it can have any length. Then, write assignment statements that would store the first half of the vector in one variable and the second half in another. Make sure that your assignment statements are general, and work whether vec has an even or odd number of elements (Hint: use a rounding function such as fix).Integers are read from input and stored into a vector until 0 is read. If the vector's last element is odd, output the odd elements in the vector. Otherwise, output the even elements in the vector. End each number with a newline. Ex: If the input is -9 12 -6 1 0, the vector's last element is 1. Thus, the output is: -9 1 Note: (x % 2 != 0) returns true if x is odd. int value; int i; bool isodd; 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 } cin >> value; while (value != 0) { } for (i = 0; i > value; Check return 0; 1 Next level 2 X 1: Compare output 3 4 For input -9 12 -6 1 0, the vector elements are -9, 12, -6, and 1. The last element, 1, is odd. The odd elements in the vector, -9 and 1, are output, each on a new line. Not all tests passed. 2 V 3
- Integer numin is read from input. Given the integer vector yearlySalary with the size of numin, write a for loop to initialize the first half of yearlySalary with the remaining integers read from input. Ex: If the input is 6 116 132 134 then the output is: 116 132 134 0 0 0 Note: The vector size is always even. 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21} vector yearlySalary; unsigned int i; int numIn; cin >> numIn; // Creates a vector of size numIn and initialize all values to 0 yearlySalary.resize(numIn); /* Your code goes here */ for (i = 0; i < yearlySalary.size(); ++i) { cout << yearlySalary.at (i) << " "; } return 0;Python Let x be a vector. How do you use rotate(deg) to find a vector y that is normal to x? Namely <x,y> = 0.Finding the Minimum of a Vector Write a function to return the index of the minimum value in a vector, or -1 if the vector doesn't have any elements. In this problem you will implement the IndexOfMinimumElement function in minimum.cc and then call that function from main.cc. You do not need to edit minimum.h. Index of minimum value with std::vector Complete IndexOfMinimumElement in minimum.cc. This function takes a std::vector containing doubles as input and should return the index of the smallest value in the vector, or -1 if there are no elements. Complete main.cc Your main function asks the user how many elements they want, construct a vector, then prompts the user for each element and fills in the vector with values. Your only task in main is to call the IndexOfMinimumElement function declared in minimum.h, and print out the minimum element's index. Here's an example of how this might look: How many elements? 3 Element 0: 7 Element 1: -4 Element 2: 2 The minimum value in your…
- Integers are read from input and stored into a vector until 0 is read. If the vector's last element is odd, output the odd elements in the vector. Otherwise, output the even elements in the vector. End each number with a newline. Ex: If the input is -9 12 -6 1 0, the vector's last element is 1. Thus, the output is: -9 1 Note: (x % 2!= 0) returns true if x is odd. 4 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} vector vect1; int value; int i; bool isodd; cin >> value; while (value != 0) { vect1.push_back(value); cin >> value; } V* Your code goes here */ return 0; 2 3Write a function that removes duplicates from a vector. For example, if remove duplicates is called with a vector containing 1 4 9 16 9 7 4 9 11 (use these numbers) then the vector is changed to 1 4 9 16 7 11Integer numInputs is read from input. Given the integer vector hourlyScores with the size of numInputs, write a for loop to output the integers in the second half of hourlyScores in reverse order. Separate the integers with a vertical bar surrounded by spaces ("I Ex: If the input is 8 86 88 97 116 132 146 148 163 then the output is: 163 | 148 | 146 | 132 Note: The vector size is always even. int i; int numInputs; 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23} cin >> numInputs; // Creates a vector of size numInputs and initialize all values to 0 hourlyScores.resize(numInputs); for (i = 0; i > hourlyScores.at(i); } * Your code goes here */ cout << endl; return 0;