|<- [[week_0:Problem set 0]]|[[Lecture, continued]] ->| === terminology === introduite en semaine 0 * statement (ex: say hello) * loops (repeat 10) * boolean expressions (mouse down ?) * conditions (if, if else) ===== source code ===== ==== source code ==== Source code ? what does it look like ? CS50 IDE concepts : * compiler : a general term for a piece of software that take source code and produces object code from it ( source code -> compiler -> object code ) * object code : fancy term for 0 and 1 ==== scratch -> C ==== Intéressant : après avoir montré scratch et fait utiliser, montrer l'équivalence en code source en C. Ce qui permet de limiter l'abstraction. Aussi : Le style d'écriture utilisé pour le cours des curly braces est celui-ci : smthg { //code } et non : smthg { // code } Peut-être que le style original est plus clair. === hello world === when green flag clicked -> say hellow world" équivaut en C à : int main(void) { printf("hello, world\n"); } === fonctions === say hello, world printf("hello, world\n"); === loops === forever -> say hello world while (true) { printf("hello, world\n"); } repeat 10 -> say hello world for (int i = 0; i < 10; i++) { printf("hello, world\n"); } === variables === set counter to 0 -> forever -> say counter -> change counter by 1 int counter = 0; while (true) { printf("%i\n", counter); counter++; } === boolean expressions === x < y x < y and y < x (x < y) <(x < y) && (y < z)) === conditions === if x < y -> say x is less than y else if x > y -> say x is greater than y else -> say x is equal to y if (x < y) { printf("x is less than y\n"); } else if { printf("x is greater than y\n"); } else { printf("x is equal to y\n"); } === ... === #include int main(void) { // (parameter/input) printf("hello, world\n"); // statement } previously : CS50 virtual machine with CS50 environment (linux) : make sure everyone have the same environment now : cloud9 CS50 IDE cloud : on someone else computer