Difference between revisions of "Programming Assignments - Beginning 2"

From Computer Science
Jump to: navigation, search
(Problems)
Line 9: Line 9:
 
# ''csv1'' - read a csv file and print how many rows and columns
 
# ''csv1'' - read a csv file and print how many rows and columns
 
# ''csv stats'' - read a csv file and print the stats (min, max, average) of one of the columns
 
# ''csv stats'' - read a csv file and print the stats (min, max, average) of one of the columns
 +
# ''convert1'' - convert between units (e.g., miles to/from km, degF to/from degC)
 +
# ''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)
 +
# ''arithmetic tables'' - print out arithmetic tables (for +, -, *, /)
 +
# ''primes'' - print out specified number of primes (e.g., first 10 primes, first 100 primes)
 +
# ''rectangle'' - print out a rectangle of *'s, optionally with blank interior
 +
# ''triangle'' - print out a triangle of *'s, optionally with blank interior
 +
# ''circle'' - print out a circle of *'s
 +
# ''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

Revision as of 13:38, 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