Web Page - http://www.cs.tau.ac.il/~efif/courses/ComputerProgramming
/* * Print a Fahrenheit-to-Celsius * conversion table */ #include <stdio.h> int main (void) { int fahr; int celsius; int lower = 0; int upper = 300; int step = 20; fahr = lower; while (fahr <= upper) { celsius = 5 * (fahr – 32) / 9; printf (“%d\t%d\n”, fahr, celsius); fahr = fahr + step; } return 0; } |
/* * Print a Fahrenheit-to-Celsius * conversion table */ #include <stdio.h> int main (void) { int fahr; int celsius; int lower = 0; int upper = 300; int step = 20; fahr = lower; while (fahr <= upper) { celsius = 5 * (fahr – 32) / 9; printf (“%d\t%d\n”, fahr, celsius); fahr = fahr + step; } return 0; } |
1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
unsigned int i = 0; i = i – 1; |
/* * Print a Fahrenheit-to-Celsius * conversion table */ #include <stdio.h> int main (void) { int fahr; int celsius; int lower = 0; int upper = 300; int step = 20; fahr = lower; while (fahr <= upper) { celsius = (5 / 9) * (fahr – 32); printf (“%d\t%d\n”, fahr, celsius); fahr = fahr + step; } return 0; } |
0 0 20 0 40 0 . . . .
int i; double x; i = 1; x = i; |
i = 34; double pi = 3.1415; double radius = 4; |
\n | newline |
\t | tab |
\\ | backslash |
\’ | single quote |
\” | double quote |
\0 | nul character |
i = 110; i = ‘n’; |
“A region of data storage in the execution environment, the contents of which can represent values. … objects are composed of contiguous sequences of one or more bytes, the number, order, and encoding of which are either explicitly specified or implementation-defined.”
char c; int i; double d; int lower, upper, step; |
char c = ‘x’; int i = 37; double d = 12.34; int lower=0, upper=300, step=20; |
Good:
int i = 3; double a = 19.38; double b = 12; |
Less good:
char c = 3.1415; |
/* * HelloWorld: A simple C program */ #include <stdio.h> int main (void) { printf (“Hello, world!\n”); return 0; } |
/* * Print a Fahrenheit-to-Celsius * conversion table */ #include <stdio.h> int main (void) { int fahr; int celsius; int lower = 0; int upper = 300; int step = 20; fahr = lower; while (fahr <= upper) { celsius = 5 * (fahr – 32) / 9; printf (“%d\t%d\n”, fahr, celsius); fahr = fahr + step; } return 0; } |
printf (“Hello, world!\n”); |
printf (“i is %d\n”, i); |
printf (“%d\t%d\n”, fahr, celsius); |
Command | Operation |
---|---|
ls | List files |
cp <fromFile> <toFile> | Copy fromFile to toFile |
mv <fromFile> <toFile> | Move fromFile to toFile |
rm <theFile> | Remove theFile |
mkdir <theDir> | Create theDir |
cd <theDir> | Change directory to theDir |
cat <theFile> | Display theFile |
less <theFile> | Display theFile one page at a time |
more <theFile> | Display theFile one page at a time |
man <theCommand> | Manual page for theCommand |