Successfully reported this slideshow.

Week1m

317 views

Published on

Published in: Education
  • Be the first to comment

Week1m

  1. 1. This is CS50.
  2. 2. scribe notes
  3. 3. problem set 0
  4. 4. walkthrough cs50.net/psets
  5. 5. sectioning cs50.net/section
  6. 6. office hours cs50.net/ohs
  7. 7. int  main(void){        printf("hello,  world!n");        return  0;}
  8. 8. statements
  9. 9. statementsprintf("hello,  world!n");
  10. 10. loops
  11. 11. loopswhile  (true){        printf("hello,  world!n");}
  12. 12. loops
  13. 13. loopsfor  (int  i  =  0;  i  <  10;  i++){        printf("hello,  world!n");}
  14. 14. variables
  15. 15. variables int  counter  =  0; while  (true) {        printf("%dn",  counter);        counter++; }
  16. 16. Boolean expressions
  17. 17. Boolean expressions (x  <  y) ((x  <  y)  &&  (y  <  z))
  18. 18. conditions if  (x  <  y) {        printf("x  is  less  than  yn"); } else  if  (x  >  y) {        printf("x  is  greater  than  yn");   } else {        printf("x  is  equal  to  yn"); }
  19. 19. arraysstring  inventory[1];inventory[0]  =  "Orange";
  20. 20. #include  <stdio.h>int  main(void){        printf("hello,  world!");        return  0; }
  21. 21. 10000011 00000001 00010001 00000000 00111101 11111100 01110100 0011110100000000 01000000 00000000 00000000 00000000 00000000 00000000 0000000010010000 00000000 00000000 00000000 01010000 00000000 00000111 0011000000001011 00000001 00001011 00000011 00001010 00000000 00000000 0000000000000000 00100000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00100000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000001110000 00010000 00000000 00100000 00000001 00000000 00000000 0000000000000000 00000000 00000000 00100000 00000001 00000000 00000000 0000000000000000 00000000 00000000 01000000 00000001 00000000 00000000 0000000000000000 00100000 00000000 01000000 00000001 00000000 00000000 0000000011111111 11111111 11111111 11111111 11111111 11111111 11111111 1111111110010000 10000000 00000000 01000000 00000001 00000000 00000000 0000000000101110 01100100 01111001 01101110 01100001 01101101 01101001 0110001110110000 00000100 00000000 00100000 00000001 00000000 00000000 0000000010110000 00000100 00000000 00100000 00000001 00000000 00000000 0000000010100000 00000001 00000000 00000000 00000000 00000000 00000000 0000000010110000 00000100 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00100000 00000000 00000000 ...
  22. 22. how to write a program
  23. 23. how to compile a program clang  hello.c
  24. 24. how to run a program ./a.out
  25. 25. how to compile a program clang  -­‐o  hello  hello.c
  26. 26. how to run a program ./hello
  27. 27. how to compile a program make  hello
  28. 28. functions main
  29. 29. Standard Library stdio.hprintf...
  30. 30. CS50 Library cs50.hGetCharGetDoubleGetFloatGetIntGetLongLongGetString
  31. 31. printf%c      %d      %f      %lld      %s      ...
  32. 32. escape sequencesn      r      t            "            0      ...
  33. 33. math+      -­‐      *      /      %
  34. 34. primitive typeschar      double      float      int      long  long      ...
  35. 35. CS50 typesbool      string      ...
  36. 36. precedence http://www.difranco.net/cop2220/op-prec.htm
  37. 37. how to compile a program clang  -­‐o  hello  hello.c  -­‐lcs50
  38. 38. how to compile a program make  hello
  39. 39. to be continued...

×