How do you make a peanut-butter sandwich?
How could you break that process into steps?
How could you break it down clearly enough that a computer could understand it?
Maybe your tutor could do a live demonstration of following your exact instructions...
For example: "take the peanut butter, and put it on the bread" could mean "pick up the jar of peanut butter and put it on top of the bag of bread".
You need to be very explicit about every step, eg:
What is an operating system?
What operating systems do your classmates run? The tute room? The CSE lab computers?
What are the differences between each of the various operating systems? What differences are there in their interfaces, and how do you interact with them?
What are some different ways in which you can interact with a computer?
What are the differences between graphical user interfaces and the command line? When might one be better than the other?
Discuss the following features of the sample program from lectures:
// Author: Andrew Taylor (andrewt@unsw.edu.au) // Date created: March 2016 // A very simple C program #include <stdio.h> int main (void) { printf ("I love COMP1511!\n"); return 0; }
\n
The comment in the example, is a header comment. You should make sure you have a header comment with your name, date and the purpose of your program at the top of every program you write. Comments can also be added throughout your code to make it easier for a human to understand your program.
White space is required between C language keywords. For instance you can't have intmain without any intermediate space. Statements are placed on separate lines. Additional blanks lines can be inserted to enhance readability (ie. between printf and return). The closing brace } in this example is aligned beneath the type declaration (int) for the main function, to clearly denote the end of the function block.
face0.c
, that behaves as follows:
./face0 ~ ~ 0 0 o -
face0.c
#include <stdio.h> int main(void) { printf("~ ~\n"); printf("0 0\n"); printf(" o\n"); printf(" -\n"); return 0; }
dcc -o face face.cHow could we modify it to make a program,
face1.c
, look like this instead?
./face1 ~ ~ 0 0 o \_/
face1.c
#include <stdio.h> int main(void) { printf("~ ~\n"); printf("0 0\n"); printf(" o\n"); printf(" \\_/\n"); return 0; }