Difference between revisions of "Programming Assignments - Beginning 2"

From Computer Science
Jump to: navigation, search
(Problems)
(Problems)
Line 18: Line 18:
 
# ''higher lower game'' - computer picks random number, asks user to guess, tells user if they are correct / too high / too low, keeps asking until they get it right, tells them how many guesses it took them
 
# ''higher lower game'' - computer picks random number, asks user to guess, tells user if they are correct / too high / too low, keeps asking until they get it right, tells them how many guesses it took them
 
# ''tic tac toe'' - two player version running on the same computer, alternates asking for O and X's move, checks for a win and declares the winner or a tie
 
# ''tic tac toe'' - two player version running on the same computer, alternates asking for O and X's move, checks for a win and declares the winner or a tie
 +
# ''list files'' - given a directory print a list of files in the directory, optionally including file size and last modified date/time
 +
# ''directory tree'' - given a directory print the file contents as well as contents of all sub-directories
 +
# ''change filenames'' - given a directory and file extension change all file names with the given extension in some specified way (e.g., put "OLD" on each filename)

Revision as of 14:13, 1 January 2020

This page contains some classic beginning programming exercises. You should first complete most of the problems in Programming Assignments - Beginning 1 before working on problems on this page.

Problems

  1. head - read from standard input or a file and print only the first 5 lines of a file
  2. tail - read from standard input or a file and print only the last 5 lines of a file
  3. wc - read from standard input or a file and print the total number of characters, lines, and words
  4. stats - read numbers and print the smallest, largest, and average
  5. sort - read numbers, sort them (using any sorting algorithm), and print in sorted order
  6. csv1 - read a csv file and print how many rows and columns
  7. csv stats - read a csv file and print the stats (min, max, average) of one of the columns
  8. convert1 - convert between units (e.g., miles to/from km, degF to/from degC)
  9. convert2 - convert between units with the units to convert to/from as part of the parameter (e.g., parse text like "convert 1 mile to km" and do the conversion)
  10. arithmetic tables - print out arithmetic tables (for +, -, *, /)
  11. primes - print out specified number of primes (e.g., first 10 primes, first 100 primes)
  12. rectangle - print out a rectangle of *'s, optionally with blank interior
  13. triangle - print out a triangle of *'s, optionally with blank interior
  14. circle - print out a circle of *'s
  15. higher lower game - computer picks random number, asks user to guess, tells user if they are correct / too high / too low, keeps asking until they get it right, tells them how many guesses it took them
  16. tic tac toe - two player version running on the same computer, alternates asking for O and X's move, checks for a win and declares the winner or a tie
  17. list files - given a directory print a list of files in the directory, optionally including file size and last modified date/time
  18. directory tree - given a directory print the file contents as well as contents of all sub-directories
  19. change filenames - given a directory and file extension change all file names with the given extension in some specified way (e.g., put "OLD" on each filename)