CS50x: Sectionals

DISCLAIMER: I am not affiliated with CS50 and this is purely for educational purposes.

Week 1 Section

First introduction to the cs50 IDE. Goes over the duck, style50, design50 (grades the performance/quality of code), explain highlighted code which uses ai to explain a piece of code. Introduction to C such as the hello word program #include int main (void) { printf("hello, world\n"); } the include keyword is used to import libraries such as printf command. You can see some of the functions/libraries of cs50 at manual.cs50.io. There is also #include for libraries. You can also use string name = "David"; to create a string that stores David in a variable called name. Why are data types important? Data types are important so that the computer reads the bytes in the way we intend. You can also make things like int balance = 20; for integers. Important to realize that = is an assignment operator for variables. In this case it would probably make more sense to use the data type float since the decimal values would matter. Increment this value is balance = balance + 1; or balance++;. Balance = balance / 4 or balance /= 4;. If you use division that could create a decimal with an integer value then it is done with division floor, which means even 6.7 would be 6. The % gives remainder 20 % 6 is 2. get_int will take a string will take a value from a user to make into an integer value. You could use code like this int balance = 20; printf("Current Balance: $%i\n", balance); in this case the %i will be a placeholder that substitutes with the value of balance. %i %f %c %s different format codes. Conditionals if (balance < 0 ) { printf("Insufficient funds."); } . For loops for (int i = 1; i <= 30; i++) { printf("I can count to %i!", i); }. while loop: int i = 1; while (i <= 30) { printf("I can count to %i!", i); i++; }. Do while loop int n; do { n = get_int("N: "); } while (n <= 0);. Mario problem set: talks about function and prototyping function so functions can be below main function.

Week 2 Section

Week 3 Section