Beginner’s Programming Homework
Tuesday, August 5th, 2008 | Resources
Originally posted on the CProgramming forums:
I actually found the initial problem at http://www.cs.cornell.edu/courses/cs113/2005fa/#assign. Just click on the homework assignments. You could google for college-level homework assignments for c programming and find others also. This just happened to be the first one I picked when I did the same.
An excellent point, and one I should have addressed before. Being given an assignment and working your way through to a solution is an excellent way to learn programming, perhaps one of the best. In addition to the excellent assignments offered up already let me put together a short list of assignments I can suggest:
- Make a number guessing game. The computer chooses a random number and the user makes guesses until they get it. After each guess the computer responds by giving the user a hint. Here are a few hint systems:
- Higher/Lower - The computer tells if the guess is higher or lower than the target number. Compare your solution with Letter Guess.
- Warmer/Cooler - The computer tells you how far you are from the number with some sort of distance based clues. One solution would be similar to Stars. A more robust solution would be for a certain distance from the number to compare a guess to the previous guess and tell if they are getting closer (warmer) or further (cooler), then when they are within a very close distance begin to give clues like “You’re hot/You’re on fire/You’re burning up!” until they get the right answer.
- Trap - The user inputs 2 numbers and are told if the target number is above, below, or between the numbers guessed.
- Make a 2D or 3D number guess game where the user has to input the X, Y and Z coordinates of their guess. Hints are similar to 2D games above. See Hurkle for an example.
- Write a program that calculates the minimum number and type of bills/coins you would need to make up an amount of money that the user inputs.
- Write a program that chooses from a list of adjectives, nouns, verbs, adverbs, and conjunctions and builds sentences. Bonus points if the sentences are put together in ways that could be considered poetic.
- Write a palindrome checker.
- Numerical palindrome checker - The program will check if the digits of a number input by the user can be reversed and read the same. (Must take input in the form of an int.) Examples of numerical palindromes: 101, 259952, 4114.
- Sentence palindrome checker - The program will check if the words of a sentence can be read the same in reverse order (ignoring punctuation and capitals). Examples of sentence palindromes: “fall leaves after leaves fall.” “Girl, bathing on Bikini, eyeing boy, sees boy eyeing bikini on bathing girl.” and:
- Letter palindrome checker - The program will check if the letters of a word or phrase (excluding spaces and punctuation) can be reversed and read the same. Examples of letter palindromes: “Civic.” “Race car.” “Was it a rat I saw?” “Neil, a trap! Sid is part alien!”
- Bonus points for programs that can check a whole list of numbers, sentences or words and output the ones that pass.
- Bonus points for a super palindrome checker that can check any word, phrase, or sentence and tell what type of palindrome it is if it is one. Example: “Level, madam, level!” is both a letter and a sentence palindrome.
“Son I am able,” she said “though you scare me.”
“Watch,” said I
“Beloved,” I said “watch me scare you though.” said she,
“Able am I, Son.” (From They Might Be Giants - I Palindrome I) - Write an encrypting and decrypting program that will allow you to send encoded messages.
- Start by replacing letters for numbers so A is 1, B is 2, C is 3 and so on. So MEET TONIGHT becomes 13-5-5-20 20-15-14-9-7-8-20
- Add a shift to the numbers so that you have to input the message and a key that explains where to start numbering your code. So MEET TONIGHT with a shift of 3 becomes 16-8-8-23 23-18-17-12-10-11-23. Note: Any number greater than 26 should be wrapped back around so you still only have the numbers 1-26.
- Add a step to the encryption so that after every letter the shift increases by the step. That way each letter is encoded differently and you can’t do a simple replacement. So MEET TONIGHT with a shift of 3 and a step of 2 becomes 16-10-12-3 5-2-3-26-26-3-17. (Again, remember to keep all your numbers between 1 and 26 by wrapping around numbers greater than 26.)
- After shift and step translate the numbers back into letters. So MEET TONIGHT is now PJLC EBCZZCQ.
- Now in order to decode the message the decoder will need the same shift and step and then run the process backwards. (Note that if you have a shift of zero and a step of zero the message will remain unchanged.)
- Convert an old BASIC type-in to C/C++. Try to remain as true to the original game’s rules as possible. Feel free to format the output as you like it to make it more playable.
- Make a program that will play your favorite board or card game with you, especially if one side of the game is more boring. See Battleship, Bagels, Jumping Balls, Acey Deucy, Tic-Tac-Toe, Awari, or Black Box for examples.
Now class, when you finish writing your program send it in so I can grade it. Maybe your program could be featured on Cymon’s Games!
No comments yet.
Leave a comment
Subscribe
Support Cymon's Games
Recent Comments
- David Brady on Book feedback
- Joe on Happy Thanksgiving
- Mike on Happy Thanksgiving
- Joe on NumbrixGenerator
- Joe on Book feedback
- Craig on Book feedback
- Craig on Numbrix
- Joe on Numbrix















