Download ArrayPrograms

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Arrays Programs (due two days after they are assigned)
Prog 6 Nov 1/2016. Write a program to store the even numbers from 2 to 20 (inclusive) into an
array called even, and then store the odd numbers from 1 to 19 (inclusive) into an array called
odd. The program then multiplies corresponding elements and prints out all the results a line at a
time.
For example, even[0] *odd[0] = 2 * 1 which equals 2, and even[1] * odd[1] = 4 * 3 which equal
12 and so on.
Prog 7 November 2 2016 Write a program that asks the user for ten different letters (use a loop).
Make sure all the letters are different. Then ask the user if he wishes to find the largest, the
smallest or a specific character (if it is, not found then say so). Then print out that letter and print
out the index of location it was found at.
Prog 8 November 3 2016 Write a program that asks the user, “How many characters do you
wish to sort?” Then create a loop of the appropriate size and randomly enter characters (with no
duplicates). Then have it ask, “Do you wish to sort in ascending, or descending order?” The
program then prints the sorted characters in the correct order. See page 175, the Bubble Sort for
a good hint.
Prog 9 November 4, 2016 Create a random list of 50 unique integers with values from 1 to 1000
and put them into an array. Print out the list. Then sort the array with a call to an external sorting
program. Print out the sorted list. Then ask the user what number he is searching for and if he
wishes to do a linear search or a binary search on the data. Then find the location of the piece of
information.
Prog 10 November 7, 2016 Write a program that multiples two matrices (one is 3 x 2, the other
2 x 4). Ask the user to enter information for matrix A and then for matrix B. The program then
prints out an answer in rows and columns. Remember, when you multiply the two, the answer
will be a 3 x 4 matrix.
Prog 11 November 9, 2016 Write n program that creates a schedule for a train that runs ten times
M, W, F and five times T, and Thurs and one time on Sat and Sun. Fill the array with the number
of passengers that board. Just make up the number of passengers that board. Then compute the
total number of passengers that board on Monday and also on Tuesday.
Prog 12 November 10, 2016 Write a program that accepts a paragraph about MMSTC (Enter at
least four sentences). Do the following: 1) Determine how many characters are in the
paragraph, 2) Search for the string MMSTC and decide if it’s found, 3) Ask for a substring to
search for and print out its location.
Not Doing this one. Write a program that accepts decimal grades for each quarter of the year
over the course of all four years here at MMSTC. Enter the data as decimals into a 3 D array.
The grades are entered with the use of three loops. The program then asks the user to enter a
class name as a word (IDS, MATH, SCIENCE) and a year (FRESHMAN, SOPHMORE,
JUNIOR, SENIOR). The program searches the appropriate part of the array and then prints out
the quarter with the highest grade and the actual grade.
Not Doing this one November 4, 2015 Implement a linear search algorithm for five different
names that are entered into each of the 11A, 11B and 11C classes (select an appropriate 2D
array). Ask the user for the class he wishes to search and the name he wishes to search for.
Have the program print “found” or “not found” and if found print the location the name is found
at.