1. Write pseudocode to solve the following problem.
(i) Declare an array nums that can hold 100 real numbers.
(ii) Write pseudocode to load nums with 100 values, entered via the keyboard. Assume all data are valid.
(iii) Write pseudocode to prompt for an integer target. Search array nums for target. If found, print the location where target was found. Otherwise, print “Not found”.
(iv) Briefly explain how your response to 1 (ii) would change if the input data is stored in a file instead of being read via the keyboard. Note: No pseudocode is necessary. Only an explanation is need.
2. A file “input.dat” exists and is loaded with several positive integers. Each integer is separated by at least one space and the last value in the file is -1, which signifies the end of the data. Assume all data are valid.
Write pseudocode to read the values in the file and find and print the sum of all integers in the file that are greater than 50. For example, if the file contains
5 70 10 3 80 100 -1

you are only to find the sum of the integers 70, 80 and 100.

3
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by rubberman

What did you do to solve the problem?
What's the problem with your code?

We do NOT do your homework for you. Make an honest effort to solve the problem / assignment and post what you did here, along with any issues and/or errors you encountered doing it. THEN, and only then, will we consider helping you!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.