subject

Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive integer. write some code that reads a line from one file and then a line from the other file. the two integers are multiplied together and their product is added to a variable called scalar_product which should be initialized to zero. your code should stop when it detects end of file in either file that it is reading. for example, if the sequence of integers in one file was "9 7 5 18 13 2 22 16" and "4 7 8 2" in the other file, your code would compute: 4*9 + 7*7 + 8*5 + 2*18 and thus store 161 into scalar_product.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 2
question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
Answers: 1
You know the right answer?
Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consis...
Questions
question
Mathematics, 06.06.2020 21:04
question
History, 06.06.2020 21:04
question
Mathematics, 06.06.2020 21:04
question
Mathematics, 06.06.2020 21:04
question
History, 06.06.2020 21:04