CS 70

Week 4, Lab 2 — Thursday, September 18

At the Start of Lab

What's the “magic word” for this lab?


Did you arrive on time to lab?

Today's Lab Activity

Today, we have a short lab activity. As a group, discuss these questions:

Random Character in a File, Part 1 a “-” sign.

Suppose someone says to you, “I'm looking at a C++ source file and I see a - character. Can you tell me what it might signify?”

Is that enough context to give a definitive answer?

As a group, ponder the question: In code, what does the “-” sign mean?

  • If the answer is, “it depends”, depends on what?

Random Character in a File, Part 2 a “&” sign.

Similarly, suppose someone says to you, “I'm looking at a C++ source file and I see a & character. Can you tell me what it might signify?”

Terminology

Notice some different C++ contexts:

Code Context
int x = 42; declaration (and definition)
setupFarm(3); statement
a + b expression
x = a; assignment

Context Matters

Explain why each of these bits of code is nonsensical:

  • "mint" x = 42;
  • setupFarm(int);
  • a +

Rest of the Lab

When you're finished with that task, you can work on finishing Homework 2. If you've finished but haven't actually made a patch with a real sewing machine, you can also go to the Maker Space downstairs and make one from your program's output.

  • LHS Cow speaking

    You'll need to copy the .dst file onto a USB drive and take it with you.

  • RHS Cow speaking

    And you may need to ask a steward for help to get an embroidery machine for you.

See the instructions for embroidering a patch for more details!

If you've done that and you're all caught up with the online lessons, ask Prof. Melissa about whether she can provide Homework 3 early for you to work on.

At the End of Lab

Briefly summarize what you got up to in lab.

If you did anything that might be considered “above and beyond” what was required, please share it here. (Okay to leave blank.)

Any other thoughts about today's lab? (Okay to leave blank.)

(When logged in, completion status appears here.)