Docsity

Introduction to Programming - Systems Programming - Outline | CS 351, Study notes of Computer Science

Toggle sidebar
bg1
CS 351 โ€“ Week 1 - Page 1
CS 351
Week 1
Reading:
1. The C Programming Language, Dennis M Ritchie, Kernighan, Brain.W , Chapter 1
Objectives:
1. An Introduction to Programming.
2. To learn basic concepts of Programming.
Concepts:
1. Introduction
2. Programming Basics
3. Primitive Datatypes
4. Lab Exercise
Outline:
1. Introduction
a. Declarative vs. Imperative knowledge
b. Expressing imperative knowledge requires languages
c. Program complexity
d. Unix Commands
e. Identifier
2. Programming Basics
a. Number representation
b. Basic program structure
c. Code examples
d. Keywords
e. Programming Exercise
3. Primitive Datatypes
a. Definition
b. Integer datatype
c. Floating point
d. Boolean
e. Char datatype
f. Constants
g. Code Examples
Reference:
1. http://www.ece.umd.edu/class/enee114/handouts/midterm1-review.pdf
2. http://www.coronadoenterprises.com/tutorials/c/chap01.htm
3. http://www.coronadoenterprises.com/tutorials/c/chap02.htm
pf3
pf4

Partial preview of the text

Download Introduction to Programming - Systems Programming - Outline | CS 351 and more Study notes Computer Science in PDF only on Docsity!

CS 351

Week 1

Reading:

  1. The C Programming Language, Dennis M Ritchie, Kernighan, Brain.W , Chapter 1

Objectives:

  1. An Introduction to Programming.
  2. To learn basic concepts of Programming.

Concepts:

  1. Introduction
  2. Programming Basics
  3. Primitive Datatypes
  4. Lab Exercise

Outline:

  1. Introduction a. Declarative vs. Imperative knowledge b. Expressing imperative knowledge requires languages c. Program complexity d. Unix Commands e. Identifier
  2. Programming Basics a. Number representation b. Basic program structure c. Code examples d. Keywords e. Programming Exercise
  3. Primitive Datatypes a. Definition b. Integer datatype c. Floating point d. Boolean e. Char datatype f. Constants g. Code Examples

Reference:

  1. http://www.ece.umd.edu/class/enee114/handouts/midterm1-review.pdf
  2. http://www.coronadoenterprises.com/tutorials/c/chap01.htm
  3. http://www.coronadoenterprises.com/tutorials/c/chap02.htm

1. Introduction A. Declarative vs. Imperative knowledge 1. Declarative: "What is true" knowledge 2. Imperative: "How to" knowledge 3. Programming: act of expressing "how to" knowledge B. Expressing imperative knowledge requires languages 1. Languages contain vocabulary (words), syntax, and semantics 2. Languages differ in a.Programming model b. Number of features c. Specificity C. Program complexity 1. Metric: Source Lines of Code 2. Complexity management techniques a. Abstraction b. Good coding conventions D. From recitation: UNIX commands 1. mkdir, cd, mv, cp, ls E. What is an Indentifier? 1. An identifier is used for any variable, function, data definition, etc. 2. An identifier is a combination of alphanumeric characters, the first being a letter of the alphabet or an underline 3. The remaining being any letter of the alphabet, any numeric digit, or the underline. 2. Programming Basics A. Number representation 1. Binary encoding of numeric values 2. Converting from binary to decimal, and decimal to binary 3. Base-n encoding 4. Converting from base-n to decimal, and decimal to base-n 5. Hexadecimal and octal representations 6. C syntax for binary, hex, and octal B. Basic program structure 1. Statements, main, declaration, #include, comments 2. Standard I/O library, and "stdio.h" header file 3. printf (), scanf() a. Formatting strings b. "%" placeholders c. "&" notation 4. Variables a. Declaration: type, name, and storage allocation. b. Initialization 5. "while" loops 6. Compilation

D. Boolean

  1. Takes on two possible values: true or false
  2. No special representation of booleans in C: use ints
  3. Logical operations: not (!), and (&&), or (||)
  4. Relational operations: <, >, ==, !=, <=, >=
  5. Bitwise logical operations: not (), and (&), or (|), xor (^)
  6. Shift operations: right shift (>>), left shift (<<) E. char datatype
  7. Declaration
  8. Representation a. Integer of size 8-bits b. Both signed and unsigned versions c. Encoding of English character set using ASCII mapping d. ASCII mappings exist for first 127 positive values e. Special characters
  9. Operations a. Includes integer operations b. Assignment using โ€™โ€™ syntax
  10. I/O a. "%c" formatting placeholder in printf and scanf b. putchar(int c) c. getchar() F. Constants
  11. #define
  12. "const" keyword G. Operator precedence H. Code examples
  13. circle.c 4. Lab Exercise
  14. Write a program to print a message?
  15. Write a program to add two integers?

Solutions:

1.void main() { printf (โ€œ\n This is CS 351 Systems Programming\nโ€); }

2.void main() { int a,b,c; printf(โ€œ/n enter any two integer numbersโ€); scanf(โ€œ\n %d,%dโ€,&a,&b); c=a+b; printf(\n The addition of two numbers is %dโ€,c); }