Input two arrays of information

Assignment Help Basic Computer Science
Reference no: EM131268730

Write a program that will input two arrays of information. Each array will contain exactly 4floating point values. Your program will enter these values from standard input. Once the values have been read in, your program should call a function that will compute the inner product of these two arrays. The function should return the value back to the main program. The main program will then print out the value. You should not print the value out inside the inner product function. The inner product of two arrays is a single number obtained by multiplying corresponding elements and then adding up their sums.

E.g., if array u = (5, 1, 6, 2) and array v = (1, 2, 3, 4) then the inner product is 33

because (5 * 1) = 5 (1 * 2) = 2 (6 * 3) = 18 (2 * 4) = 8

and 5 + 2 + 18 + 8 is 33.

Your main function will call a function called inner that has the following declaration:

float inner ( float u[], float v[], int size ) ;

Do not hardcode the loop inside inner to go from 0 to 3.

It should go from 0 to size-1.

Reference no: EM131268730

Questions Cloud

What effects has oprah''s charisma had on her followers : What effects has Oprah's charisma had on her followers?
Write a single statement that assigns the values : Write a single statement that assigns the values 99, 100 and 88 to an integer array named TestScores. Use the C++ notation used for the "lotterynumbers" array.
Nested loops to generate a triangle : Write a program called program41.py that uses a for loop and the range functionto output the numbers from 5 up to 100 - Write another program called program42.py that generates exactly the same output
Method that returns the number of consonants : Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the number of vowels in the string, and another method that returns the number of consonants in the string. Demonstrate the ..
Input two arrays of information : Write a program that will input two arrays of information. Each array will contain exactly 4floating point values. Your program will enter these values from standard input.
Malloc up space for a one-dimensional array of n integers : Write a program that will first read in a positive integer number, say n, from standard input. Then you need to create enough space in the heap via a call to malloc to hold an array of n integers.You then need to use array index operators to fill ..
How fast is its daily cost for hamburgers increasing : If the restaurant s daily sales are increasing at the rate of 30 hamburgers per day, how fast is its daily cost for hamburgers increasing?
Determine the average of some integers : Write a program named program43.py that uses nested loops to generate a triangle as shown in the sample run. The program should begin by prompting the user to enter the number of lines in the triangle.
How fast is its daily cost for hamburgers increasing : If the restaurant s daily sales are increasing at the rate of 30 hamburgers per day, how fast is its daily cost for hamburgers increasing?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Determine the type of representation of knowledge

Determine the type of representation of knowledge of the robot's simulated environment to be used and processed by a self-organizing neural network acting as its "brain." By changing the environmental conditions, determine which conditions the rob..

  Network consultation proposal

Explain the role of integrity and availability in a networked environment.Use technology and information resources to research issues in computing networks.

  What the next state of the machine should be as a function

what the next state of the machine should be as a function of the current state. then produce a combinational circuit using gates and D-flipflops that implements this state machine. label the least and most significant bit.

  Explain finding a feasible assignment as a shortest path

We say that a course assignment is a feasible assignment if every faculty member teaches either their first or second choice course. Formulate the problem of finding a feasible assignment as a shortest path, max flow, or min-cost flow problem.

  Pseudocode to accept two numbers

Write a pseudocode to accept two numbers,divide the first number by second,and display their quotient?

  Features of windows and linux operating systems

Compare the Security features of windows and Linux operating systems?

  What is the least number of threads that must be engaged

What is the least number of threads that must be engaged for the thread shear strength to be equal to the bolt tensile strength if the nuts are made of steel whose yield and proof strengths are 70 percent those of the bolt steel?

  Demonstrate that the following fas are equivalent

For each of the following pairs of regular languages, find a regular expression and a Finite Automata (FA) that each define L1 intersection L2.

  What is the cyclomatic number of the program

Identify all independent execution path (basis path) in this program.

  Key concept in information systems

Use the Internet or the Strayer Library to research one (1) concept in information systems that you have studied in this course. You may select a topic of your choice or you may use one (1) of the following:

  Create a class list containing class node

1. Create a simple linked list program to create a class list containing class node { void *info; node *next; public: node (void *v) {info = v; next = 0; } void put_next (node *n) {next = n;} node *get_next ( ) {return next;} void *get_info ( ) {retu..

  Methods to display the applets code base and document base

Write a java applet that uses the getCodeBase() and getDocumentBase() and methods to display the applets code base and document base, respectively. Hint: Use the toString() method of the URL class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd