D level: Do ONE problem out of an assigned pool of 2 problems

  • Work in these files
    dlevel.h
    dlevel.impl.cpp
    dlevel.main.cpp 
    

  • You must follow the programming style as taught in class, e.g: you may NOT use any globals except for global constants, you must use local variables and pass arguments where appropriate.
  • For all D level problems, you must define and use a class with appropriate member functions.
  • Run your solution against ALL the provided data files for your particular problem. Check your results against the results in the CorrectOutput file.
  • You do not need to rename your files. However, make sure your name, section, and andrew ID is at the top of each of your files.

Problems

Back to rules



Problem d1

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read a file of floating point numbers into a Vector.
    • Filter (throw away) numbers that are larger than or equal to the first number in the file
    • Report the throw-away numbers to the screen.
    • Don't include the throw-away or the first number in your Vector.
  3. Display the contents of the Vector in reverse order.
  4. Compute and display the average value of the numbers in the Vector.
  5. Display the numbers in the Vector that are above the average.
  • There are two test files.

Back to list of problems
Back to rules


Problem d2

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read two files of floating point numbers into two Vectors. You may only use one class. The class may only have one Vector in it.
  3. Compute and display the range (high and low) of the values in each Vector
  4. Display the contents of the Vector with the greater range in reverse order
  • There are two pairs of test files.

Back to list of problems
Back to rules


Problem d3

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read two files of floating point numbers into two Vectors. You may only use one class. The class may only have one Vector in it.
  3. Compare the two lists of numbers: either display the message
    • "Files are identical"
    • or display the location where the first difference occurs and the two values where the difference was found.
    • or report if they are of different lengths.
  • There are four pairs of test files.

Back to list of problems
Back to rules


Problem d4

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read a file of integers into a Vector.
  3. Display all the values in the Vector that are evenly divisible by 3.
  4. Compute and display the average of all the numbers that are divisible by 3. If there are no numbers divisible by 3, display that information instead.
  5. Display the product of the numbers in the even POSITIONS.
  6. Display the contents of the Vector in reverse order.
  • There are two test files.

Back to list of problems
Back to rules


Problem d5

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read a file of integers into a Vector.
  3. Display the contents of the Vector in reverse order.
  4. Determine if the Vector is the same backwards as forwards and display that information.
  • There are four test files.

Back to list of problems
Back to rules


Problem d6

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read a search string from the first line of the file
  3. Read the next line of the file into a Vector of strings.
  4. Display the Vector of strings on the screen.
  5. Display dashes under strings from the Vector that match the search string on the next line of the screen
  • There are two test files.

Back to list of problems
Back to rules


Problem d7

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read a file of integers into a Vector.
  3. Display the contents of the Vector in reverse order.
  4. Display the numbers in the Vector that are unique (only appear once in the Vector)
  • There are two test files.

Back to list of problems
Back to rules


Problem d8

  1. Provide a loop that allows the user to run the program a specified number of times.
  2. Read a file of integers
    • Filter (throw away) numbers that are not between 0 and 99
    • Use a Vector to record the slot each acceptable number fits into as you read in
      • numbers between 0 and 9 fit into slot 0
      • numbers between 10 and 19 fit into slot 1
      • numbers between 20 and 29 fit into slot 2
      • numbers between 30 and 39 fit into slot 3
      • numbers between 40 and 49 fit into slot 4
      • numbers between 50 and 59 fit into slot 5
      • numbers between 60 and 69 fit into slot 6
      • numbers between 70 and 79 fit into slot 7
      • numbers between 80 and 89 fit into slot 8
      • numbers between 90 and 99 fit into slot 9
    • Report the filtered numbers (numbers that are thrown away) to the screen as you read in
  3. Display a chart that shows how many numbers were within the following ranges
    	 
    0 -  9
    10 - 19
    20 - 29
    30 - 39
    40 - 49
    50 - 59
    60 - 69
    70 - 79
    80 - 89
    90 - 99    
    
  • There are two test files.

Back to list of problems
Back to rules