[Courses] C Programming For Absolute Beginners, Lesson 6: Moar Functions, Local, Static, Global Variables

Carla Schroder carla at bratgrrl.com
Tue Apr 10 03:24:12 UTC 2012


On Sunday, April 08, 2012 10:37:46 PM Carla Schroder wrote:
> We've tried for loops, if/else/while, doing stuff with user input, and
> simple  functions, so we have enough tools to write programs that can
> perform a few different tasks. All programming starts with a clear design;
> just like building a house you must start with a plan. Jacinta shared a
> lesson she uses with her students: write a program to make coffee. So start
> first with the program design and lay out all the steps:
> 
>      1. Assemble everything (cup, spoon, coffee, kettle, milk, water etc)
>      2. Put water in the kettle and boil [*]
>      3. Put coffee in cup
>      4. Pour hot water into cup [*]
>      5. Add milk (if desired) [*]
>      6. Stir [*]
> 
> Then write the program. Write this one, write your own program for planning
> a  party (hi Leslie!), planting a garden, building a new PC, creating a
> simple book catalogue-- anything you want. Show your steps and then your
> program.

I haven't started writing my program yet, but here is my draft program logic 
for "Feeding Protocol at Little Critter Ranch"

1. Set alarm for 7am
2. Get awakened at 6am by cats
3. Mass potty exodus
4. Who should I feed first? Reward obnoxiousness (cats) or politeness (dogs and 
horses)?
5. Special needs cats first
6. Then normal cat
7. Feed horses with assistance from dogs
8. Dogs eat last

It's going to be fun to see how this translates into code. I'm imagining 
something like Legend of the Red Dragon.

best,
Carla
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carla Schroder
ace Linux nerd
author of Linux Cookbook,
Linux Networking Cookbook,
Book of Audacity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the Courses mailing list