How it works

Upload & Edit
Your PDF Document
Save, Download,
Print, and Share
Sign & Make
It Legally Binding
Customers love our service for intuitive functionality
Rated 4.5 out of 5 stars by our customers

What Are Some Of The Best C?

I agree with Joseph Newcomer that graphics projects are good, though I’m pretty sure all that object-oriented crap is neither helpful nor necessary. When I teach Plain English programming to beginners, I often start with a series of short (20 lines or less) programs that look impressive on the screen when t are run. Maybe you could write some C++ programs that do similar things. Here’s how we do it. We group all the programs into a single application so the student can see how large programs are grown, not written all at once. We start, of course, with a completely blank screen and a design; in this case we lay out the screen with a “work area” on the left and a “menu area” on the right (click on any graphic to enlarge it). Then we show the student how that will look when we’re done bringing it to life on the screen. After that, we write a little program for each command on the menu (ie, each letter of the alphabet), starting with “Alphabet Soup.” This first exercise teaches the student about sequence, conditional statements, looping, shapes, sizes, colors, orientations, locations and graphical masking (so the soup doesn’t spill outside the bowl, so to speak). To cook up the soup. Start fresh. Loop. If the user clicks on the choices, break. Pick a letter of the alphabet. \ shape Pick a letter height between 1/8 inch and 1/2 inch. \ size Use the fat pen. \ size Pick a color. \ color Pick a spot anywhere in the work area. \ place, location Pick a heading. \ angle, orientation, direction Write the letter. Refresh the screen. Add 1 to a count. If the count is 1000, break. Repeat. Then we do some turtle graphics to show how beautiful blooms that are mathematically very difficult to describe can be created simply and easily with short algorithms. To draw the circle bloom. Start fresh. Move to the center of the work area. Pick a dark color. Put 1/4 inch into a size. Loop. If the user clicks on the choices, break. Draw a circle given the size. Turn left 1/10 of the way around. Lighten the current color about 3 percent. Add 3/16 inch to the size. Refresh the screen. Add 1 to a count. If the count is less than 300, repeat. Then we talk in a little more detail about colors, using this color wheel as our visual (and programming) aid. To draw the color wheel. Start fresh. Start with the red color. Turn right 80 points. Loop. If the user clicks on the choices, break. Move to the center of the work area. Draw a line 2 inches long. Refresh the screen. Change the current hue by 10 points. Turn right 10 points. Add 1 to a count. If the count is 384, break. Repeat. Start in the middle of the work area facing north minus 80 points. Use medium-sized letters. Write "RED......YELLOW.....GREEN......CYAN......BLUE.....MAGENTA......" with the white pen 2-1/4 inches from the work area's center. Refresh the screen. We talk about the RGB system, and the CMYK system, and the HSL system (which is the one used internally in our system). And the curious fact that the many and varied shades of brown we know and love fall at the light and dark ends of the narrow orange slice of the pie. After that, we draw desert landscapes using a mixture of turtle and conventional graphics, to show the student the advantages and disadvantages of each. And to make use of some those light and dark orange — er, brown — hues. To draw a desert landscape. Start fresh. Draw the sky. Draw the sun. Draw the birds. Draw the sand. To draw the sky. Use the lightest sky blue pen. Imagine a line across the middle of the work area. Loop. If the user clicks on the choices, break. Draw the line. Refresh the screen. Darken the current color about 3 percent. Move the line up 1 pixel. If the line is above the work area's top, break. Repeat. To draw the sun. Pick a spot anywhere in the top middle 1/4 of the work area. Make a dot between 1/4 inch and 1 inch wide. Center the dot on the spot. Draw the dot with the lightest yellow color. To draw the birds. Pick a spot in the work area about 1 inch above the middle. Use the black pen. Loop. Move to the spot. Face east. Pick a width between 1/8 inch and 1/4 inch. Draw a quarter circle given the width. Turn around. Draw another quarter circle given the width. Move the spot about 1/2 inch in any direction. Add 1 to a count. If the count is 3, break. Repeat. To draw the sand. Use the lightest orange pen. Imagine a line across the middle of the work area. Loop. If the user clicks on the choices, break. Draw the line. Refresh the screen. Darken the current color about 3 percent. Move the line down 1 pixel. If the line is below the work area's bottom, break. Repeat. Then we draw a simple “escargo” because it was the best thing we could think of that started with the letter “E”. To draw the escargot. Start fresh. Move down 5/8 inch. Put 1/4 inch into a width. Pick a really dark color. Loop. If the user clicks on the choices, break. Draw a circle given the width. Refresh the screen. Wait for 1 ms. Lighten the current color about 15 percent. Turn right 1/48 of the way. Add 1/16 inch to the width. If the width is less than 3 inches, repeat. After that, we talk about local variables and recursion (routines that call themselves) using an example that is more visually stimulating than, say, a mathematical factorial, like this nice fractal forest. To draw a fractal forest. Start fresh. Loop. Start anywhere on the work area's bottom line. Pick a greenish color about 80 percent of the time. Pick a brownish color about 20 percent of the time. Pick a size between 2 and 6 inches. Draw a forest tree with the size. Refresh the screen. Wait 1/5 second. Add 1 to a count. If the count is less than 10, repeat. To draw a forest tree given a size. If the user clicks on the choices, exit. Remember where we are. If the size is less than 1/4 inch, draw a line using the size for the length; go back to where we were; exit. Draw another line using the size divided by 3 for the length. Pick a number between 1 and 6. If the number is not 1, turn left 1/12; draw a right-handed forest tree given the size times 2/3; turn right 1/12. If the number is 1, turn right 1/12; draw a left-handed forest tree given the size times 2/3; turn left 1/12. Draw a third line using the size divided by 6 for the length. Turn right 1/24. Draw another forest tree given the size divided by 2. Turn left 1/24. Draw a fourth line using the size divided by 3 for the length. Turn right 1/24. Draw a third forest tree given the size divided by 2. Turn left 1/24. Draw a fifth line using the size divided by 6 for the length. Go back to where we were. And so forth. I’m sure you get the idea, so won’t go through the whole alphabet, except to say that some of the exercises create interactive programs that teach the student how to handle mouse and keyboard input; and to point out that not all of our training programs are graphical in nature. For example, under “R” we have a “Reverse Polish Notation” calculator that teaches the student about text-only input and output, the use of LIFO (last in, first out) stacks, and easier ways to write mathematical expressions. To do the reverse polish notation thing. Start fresh. Write "REVERSE POLISH NOTATION (RPN) IS A WAY OF WRITING FORMULAS WITHOUT PARENTHESES." on the terminal. Write "WE PUT THE OPERATORS ( + - * / ) AFTER THE NUMBERS INSTEAD OF BETWEEN THEM." on the terminal. Write "SO 1 + 1 BECOMES 1 1 + AND 5 + ( 3 - 1 ) BECOMES 3 1 - 5 + OR 5 3 1 - +" on the terminal. Write "DON'T FORGET TO PUT SPACES BETWEEN THE NUMBERS AND THE OPERATORS." on the terminal. Loop. If the user clicks on the choices, exit. Skip a line on the terminal. Write "ENTER AN RPN FORMULA FOR ME TO SOLVE." on the terminal. Read a reply from the terminal. If the reply is blank, repeat. Process the reply. Get a result string from the stack. Write the result string on the terminal. Repeat. To do the add thing. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get a number from the stack. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get another number from the stack. Add the other number to the number. Put the number on the stack. To do the divide thing. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get a number from the stack. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get another number from the stack. Divide the other number by the number. Put the other number on the stack. To do the multiply thing. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get a number from the stack. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get another number from the stack. Multiply the other number by the number. Put the other number on the stack. To do the subtract thing. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get a number from the stack. If the stack is empty, put "NOT ENOUGH NUMBERS" on the stack; set the error flag; exit. Get another number from the stack. Subtract the number from the other number. Put the other number on the stack. Then we take a step back and draw some “Unimaginable Objects” using alphabetical Cartesian coordinate strings in statements like… Make a figure using "HYHDJDHDFBHBJDJYHYFVFB" and the work area's center. …with a little bit of “smoothing” here and there to turn squares into circles, like… Make a fourth figure using "NBNDPDPBNB" and the work area's center. Smooth the fourth figure 3 times. …to produce drawings like… …and… …and. Under “V,” to teach the student about linked lists and dynamic memory management, we write a search algorithm that reads the entire Bible into a list of about 32,000 verses, then searches that list for verses containing words entered by the user. When we’re done with the alphabet, the student has experienced, first hand (and often in several different ways) almost all of the fundamental concepts and techniques that he will need to write interesting programs of his own. So those are some fun (and educational) projects for programmers who are just starting out and want to impress their teachers. Et voila!

Get your PDF documents done in seconds