Introduction to Computer Programming

Instructor: Eric Foo Contact info available at my profile page.

This 5-day crash course in programming will cover some basics in C++ coupled with some in-class and take home assignments.

You can work on the assignments as a group but you should submit the assignments individually. In fact, I highly encourage you to work together since everyone here has different programming experience. You can upload the assignments to this wiki.

2009 Programming Class Photos

Topics covered are:

Day 1:

  • Assignment:
    1. Complete tutorial on Visual Studio
    2. Complete the tutorial on file input/output in the code cincout.cpp (Download sample code in link below).
    3. Pick a project that is suitable for your group, and write a pseudo-code (outline in words) of your project. Also submit (as a group) a 1 page proposal on what the project is about, what each person is responsible for (i.e how the code will be divided), and a what are the deliverables by the end of the week. Include a day-to-day timeline on what needs to be completed. Put together a 1 slide presentation about your project based on the proposal. Start coding if you have time.

  • Notes/Code/Slides:
    • Download code for class here (.zip file)
    • Some programming tips and common errors. PDF
    • Slides from lecture here (in PDF format)

Day 2:

  • Each group will give a single slide presentation (3 mins) about their project
  • Control structures - if/else conditions, for/while loops
  • Math library functions

  • Assignment:
    1. Write a program that will perform unit conversion, i.e. Celcius to Fahrenheit, Lbs to Kg, feet to meters, etc and back. Feel free to add more complex units if you can, i.e pound-force to Newtons. Or even try currency conversion!
    2. EXTRA CREDIT: Write a math quiz program. Program will print out simple math equations (addition, subtraction, multiplication, division) and the user will type in the correct answer. HINT: Use the random number generator to select the operation and the numbers.
    3. EXTRA CREDIT: Modify the unit conversion program you wrote to use functions instead. i.e. converting Celcius to Fahrenheit can be a function called convertCelciusToFahrenheit().

  • Notes/Code/Slides:
    • Download code for class here (.zip file)
    • And here (.zip file)
    • Slides from lecture here (in PDF format)

Day 3:

  • Functions
  • Arrays
  • Characters and Strings

  • Assignment:
    1. Write a simple program to process strings. User types in a sentence and your program parses this sentence and counts the number of words typed. HINT: You can 'break' the sentence up using a string token 'strtok' and the sample code provided shows you how to do this.
    2. EXTRA CREDIT: Sort the words in alphabetical order by the first letter of the word. You can easily obtain source code for a "bubble sort" code online. Or you can also use STL Maps. If you choose to do this, you can limit the number of words typed to 5.

  • Notes/Code/Slides:
    • Download code for class here (.zip file)
    • Slides from lecture here (in PDF format)

Day 4:

  • File input and output
  • Pointers

  • Assignment:
    1. Write a program that reads in a text file called "questions.txt" with questions i.e your name, age, where you're from, favorite music/movie/color, etc
    2. The program will ask you these questions and you'll type in the appropriate answers.
    3. Save the answers to a separate text file called "answers.txt".
    4. EXTRA CREDIT: Specify the filename to save the output file at runtime.
    5. EXTRA EXTRA CREDIT: Download the sample code (MusicLoader .cpp) for playing an MP3 file here. Modify it to read in a text file of at least 2 filenames to some MP3 files (a playlist of some sort). The code will read in this text file and play the files one after another. You can download additional sample audio files here.

  • Notes/Code/Slides:
    • Download code for class here (.zip file)
    • Slides from lecture here (in PDF format)

Day 5:

  • Structures and Classes
  • Review
  • Project completion, so no assignments! smile

  • Notes/Code/Slides:
    • Download code for class here (.zip file)
    • Slides from lecture here (in PDF format)

Day 6 (Tuesday 6/9):

  • Project Presentations

Projects

Projects will be completed in a group. Each group will give a 5 minute presentation on Day 6 about their projects and a quick demo. Upload your project on this wiki followed with a short description of your program.

Everyone will vote for their favorite project/presentation and there will be a prize smile And no, you cannot vote for your own project, sorry.

Here are some ideas for a project but feel free to come up with something on your own.

  • Hangman
  • Text version of "Wheel of Fortune"
  • Text-based RPG
  • Blackjack
  • Sudoku

Some of you asked about how the "best" project will be voted, so here are some criteria to consider:

  1. Usability: Is it easy to learn/use the controls for the application? How long did it take you to learn it? Are the necessary information/instructions provided prior or during the game?
  2. Durability: Any bugs? Did the application crash during use? (This will be a lower priority since this is only a 5-day project)
  3. Do you think the application performed as described?

Uploading assignments/projects:

  • Assignment: Put all the assignments and projects in zip files. Upload everything to this wiki page. I think they have a limit of 10MB for file size, if your files are bigger than that, let me know and you can give it to me on a USB drive. Everything is due by noon Monday June 9 2008.

How to upload your assignments and projects:

  1. Zip your entire assignment up as a single zip file. Be sure to name your file like so: Name_Assignment1.zip. This is to prevent any filename conflict.
  2. Click on the "Attach" button, browse and select your zip file.
  3. UNCHECK the "Batch Upload" box.
  4. CHECK the "Create a link" box.
  5. CHECK the "Do not show attachment in table" box.
  6. Click the "Upload File" button.
  7. It should have created a link for your file at the bottom of this page.
  8. Now copy that link into the appropriate box in the table below.

Programming Resources:

VRAC DEV Help mailing list: dev-help at vrac dot iastate dot edu. This is a really good resource for help when you encounter any coding problems. Best way to approach this mailing list is to be as descriptive as possible about your problem and it wouldn't hurt to include information about the API, the compiler, and the operating system you are working on.

Some helpful links:

Additional libraries:

Topic revision: r14 - 2009-07-27 - 18:41:13 - ZayiraJordan
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback