Register and join over 40,000 other developers!
Salis is an artificial life simulation, based on Tom Ray's Tierra.
nino - Apr 12 2018 09:13 AM
How do you choose best company for android app development?
Amyrivers - Oct 17 2017 01:24 AM
Recent Blog Entries
Recent Status Updates
- Managed C++
- Visual Basic 4 / 5 / 6
- linked list
- hello world
[Homework] Loading and finding integers in an arraypseudocode
1 reply to this topic
Posted 24 November 2015 - 06:27 PM
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.