1 / 9

Welcome to: CSC234 C and Unix

Welcome to: CSC234 C and Unix. Paul Hatalsky www.csc.calpoly.edu/~phatalsk/234/csc234.html. What You Will (hopefully) Learn About. Unix An operating system Command-line based Suite of tools Editors, compilers, Programming concepts Apply to (nearly) ALL programming languages

hunter
Download Presentation

Welcome to: CSC234 C and Unix

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to:CSC234C and Unix Paul Hatalsky www.csc.calpoly.edu/~phatalsk/234/csc234.html

  2. What You Will (hopefully) Learn About • Unix • An operating system • Command-line based • Suite of tools • Editors, compilers, • Programming concepts • Apply to (nearly) ALL programming languages • Decision statements (if statements), Functions, Loops, Arrays, Strings, Structures, design, etc. • C • Widely used, fast, umm, required for this course • Many annoying minute details • Error prone!

  3. Operating Systems • What’s an operating system? • Interface between programs and machine hardware • What’s a command-based operating system? • The interface to the computer is through typed commands • In windows, we call it a dos window • In Unix, we call it a shell (or a terminal window)

  4. Labs • 14-255, 14-257, 14-232, 14-301, 14-302, 14-303 • Structure: • Each of you will have your own account

  5. What is a program? • Program = software = application = executable • Executables are in binary so that computers can understand them. • Simply a series of commands • We cannot easily understand them 10001110011101010 10101001000001111 … … 00111000101010001

  6. What is a program? (continued) • A program is an ordered list of instructions to the computer, written in a certain programming language. • Just like making mac and cheese: • Boil water • Add pasta • Cook for 8 minutes • Drain water • Add cheese powder, milk, butter • Stir ingredients • EAT!

  7. Program Example – Burrito making Robot • Set of commands it understands • LT() – Lay down tortilla • FT() – Fold tortilla • AI(ingredient) – Add ingredient to the burrito • Set of possible values for ingredient • Beans • Cheese • Chicken • Rice • Salsa • Beef • Sour Cream

  8. What is code? • Also known as “source code” or “source” • Code is written in text so that we can understand it. Well…sort of… • #include <stdio.h> • #define CALORIES_PER_BEAN 4.0 • #define CALORIES_PER_HOUR 750.0 • #define MIN_PER_HOUR 60 • int main(void) • { • int beansEaten, calConsumed; • double minCycling; • /* User input */ • printf("How many jelly beans did you eat?\n"); • scanf("%d", &beansEaten); • /* Calculations */ • calConsumed = beansEaten * CALORIES_PER_BEAN; • minCycling = calConsumed/CALORIES_PER_HOUR*MIN_PER_HOUR; • /* Output */ • printf("You ate %08d beans, consumed %d calories\n", beansEaten, calConsumed); • printf("You and should cycle for %f minutes\n", minCycling); • return 0; • }

  9. How do we make our code execute (run)? • Code must first be compiled, then it can be run. int main (void) { c = a+b; return c; } Compiler 10001110011101010 10101001000001111 … … 00111000101010001

More Related