Lec11

# Lec11 - Lecture 11: Passing to Functions PIC 10A Todd...

This preview shows pages 1–3. Sign up to view the full content.

1 Lecture 11: Passing to Functions PIC 10A Todd Wittman A Comment on Comments When commenting your homework, QUANTITY QUALITY !!! Some students are commenting every line of code, but the comments are mostly meaningless. int x = 1; //Sets integer x=1. while ( x < 20 ) { //This is a while loop. cout << x << “ “; //Outputs x and “ “. x = x + 2; //Adds 2 to x. } //Ends the while loop. Comments are meant to help the reader understand the code, not make it harder to understand!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 A Comment on Comments Would have been much better to just comment on the block of code, rather than commenting every line. // Print out the odd numbers 1 through 19. int x = 1; while ( x < 20 ) { cout << x << “ “; x = x + 2; } You were told it’s OK to over-comment your HW, but this assumes you write worthwhile comments. Suppose you’re taking a history test. .. Question #1 [20 points]: What were the major causes of World War II? It’s OK to write a long answer to justify your reasoning. Student’s Answer : I like fudge. Kittens are cute. Mercury is the closest planet to the Sun. Some people think the Moon is made of cheese, but it’s not. Frodo is a hobbit, Gimli is a dwarf, and Legolas has pointy ears. So what the heck is Gollum? He doesn’t look like anything. How come orcs are so easy to kill? The major causes of World War II were the economic adversity of the Great Depression, political and cultural discontent arising from the conclusion of World War I, and the rise of totalitarian regimes. I thought orcs were supposed to be all fierce and stuff. I thought I was smart. I thought I was right. I thought it better not to fight. I thought there was a virtue in always being cool. So when it came time to fight, I thought I’ll just step aside and that time would prove you wrong and that you would be the fool. I don’t know where the sunbeams end and the starlight begins. It’s all a mystery. To fight is to defend. Now tell me when would be the time that you would stand up and be a man. For to lose I could accept, but to surrender I just wept and regretted this moment that I
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/19/2011 for the course PIC 10A taught by Professor Wittman during the Fall '08 term at UCLA.

### Page1 / 8

Lec11 - Lecture 11: Passing to Functions PIC 10A Todd...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online