[go: up one dir, main page]

0% found this document useful (0 votes)
129 views5 pages

Cs 50

This document provides an overview of CS50 weeks 0 through 3. Week 0 introduces binary representation using 0s and 1s, how transistors represent bits, and ASCII encoding of characters. Week 1 discusses C programming basics like main functions, compilers, and input/output functions. Week 2 covers security, cryptography basics like secret key encryption, and string representation in binary. Week 3 is not summarized.

Uploaded by

bob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views5 pages

Cs 50

This document provides an overview of CS50 weeks 0 through 3. Week 0 introduces binary representation using 0s and 1s, how transistors represent bits, and ASCII encoding of characters. Week 1 discusses C programming basics like main functions, compilers, and input/output functions. Week 2 covers security, cryptography basics like secret key encryption, and string representation in binary. Week 3 is not summarized.

Uploaded by

bob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

EDX- CS50-

WEEK 0
Binary-
0, 1.

To represent 1 in boundary:

4 2 1
1 1 1

= 4+ 2+ 1= 7

Binary digit= BIT

No power = 0
Power = 1

Transistors- act as switches that turn on or off representing 0 and 1s.

To represent 42:
128 64 32 16 8 4 2 1
1 1 1

Similarly ASCII: uses patterns of 0,1 to represent letters.


Eg. 72 73 33: H I !

RGB: represents colours


Eg. 72, 73, 33:

WEEK 1
C programming:
comparing Scratch vs. C

Say = printf
Hello, world= (hello world)

1
Int main(void)
{
Printf(hello world)
}

Main is the default program that is run

Source code -> compiler -> machine code (0100101010)

CS50.io (in the world of Linux)


The compiler is called Clang

$Ls lists the files in the directory


$ rm removes files
$ make- makes a program- and creates a sourcefile in .c format.

$./.<programs name>

$cd change directory


$mkdir- make directory
$rmdir- removes directory

get_char
get_double
get_float
get_int
get_long_long
get_string

%s works as a place holder


String name= get_string()
Printf(hello %s/n, name)

%s strings
%f- floats
\r carriage return
\t- tabs
\
\
\a
\0

2
If
Else
Switch
For
While
Dowhile

In c :
Need to use single quotes- for one character.
Eg if(c==y)

When you define a function and the function does not take any variables you need
to include void into its declaration:
Eg. void cough(void)

Every time we compile a program we do:


-pre-processing: anything with #, is a pre-process directive
-compiling: going from source code to assembly code.
-assembling
-linking.

WEEK 2
Security and Crytography

Cntrl+L- clears the command window

Software critera-
Scope
Correctness
Design
Style aesthetics, readability.

Secret key cryptography

In: key, plaintext


Output: cipher text

String: sequence of characters


Zamyla

Type casting

can convert chars to ints, or ints to chars.

3
String= 32 bits:
\0= 00000000 (8x0 bits in a row)
Nul terminated

Z A M Y L A /0 A
L E X /0

Int main(void)

Int main(int argc, string argv[])

WEEK 3

WEEK 4

WEEK 5

WEEK 6

WEEK 7

WEEK 8

WEEK 9

4
WEEK 10

WEEK 11

You might also like