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

  Monthly payments for the next

Mr. Albers borrowed $425,000 from the bank for his new house at an interest rate of 9%. He will make equal monthly payments for the next 30 years.

  Write a program that reads in an integer value

Write a program that reads in an integer value for n and then sums the integers from n to 2*n if n is nonnegative, or from 2*n to n if n is negative. Write the code in two versions: one using only for loops and the other using only while loops.

  Resolve using an entity or an associative entity

Give an example of many-to-many relationship. Resolve using an entity or an associative entity. Which did you use? Why?

  Complete java program named textfileshoppinglist

1. Build a complete Java program named TextFileShoppingLIst. From its main method, call a method named writeShoppingList. This method takes an ArrayList of five strings provided by the user at the command line. Use a loop for repeated prompting..

  Discuss where a computer stores its basic hardware

Discuss where a computer stores its basic hardware settings, why it does so, and what some of those settings are. Compare storage devices using four criteria: versatility, durability, speed, and capacity.

  Initialize the array with the appropriate number of values

Calculate the sum of the total miles you spent running over the 10 weeks. Calculate the average number of miles you ran.

  Menu selection and organization

Describe the considerations that you would take into account when selecting the menu style for an application and why. Support your response with examples.

  Information systems lifecycle and the database system

Discuss the relationship between the information systems lifecycle and the database system development lifecycle?

  Java program to simulate a pick

Write a Java program to simulate a pick 3, 4 or 5 lottery drawing. A lottery game of this type will draw values between 0 and 9. You should use the Math.Random() or the java.util.Random() class to generate the values in the lottery drawing.

  What whistle-blower actions did dr. wigand take

What motivated Wigand to take an executive position at a tobacco company and then five years later to denounce the industry's efforts to minimize the health and safety issues of tobacco use?

  Altitudes from p onto the sides

Let ABCD be a convex quadrilateral. Let the diagonals AC and BD intersect in P. Let P E, P F, P G and P H be the altitudes from P onto the sides AB, BC, CD and DA respectively. Show that ABCD has an incircle if and only if1P E+1P G =1P F+1P H

  Use a jframe or japplet as the primary interface

Use a JFrame or JApplet as the primary interface. Extend whatever Swing elements .you need to create the animationUse at least one interface to handle events

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