March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals.

Slides:



Advertisements
Similar presentations
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Advertisements

March R. Smith - University of St Thomas - Minnesota Today’s Class Quiz RecapQuiz Recap Exam ReviewExam Review C MaterialC Material Matlab MaterialMatlab.
Lecture 2 Introduction to C Programming
Introduction to C Programming
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
Introduction to C Programming
INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240.
March R. Smith - University of St Thomas - Minnesota Today’s Class Recap of a simple programRecap of a simple program A “history” of CA “history”
March /18R. Smith - University of St Thomas - Minnesota Today’s Class Recap - simple Java programRecap - simple Java program Simple types and printingSimple.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam TopicsExam Topics.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Functions and Array ArgumentsFunctions and Array Arguments ExamExam.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Today: covering through P. 83 of textToday: covering through P. 83 of.
March R. Smith - University of St Thomas - Minnesota Today’s Class Course StuffCourse Stuff –Classroom change TOMORROW –Assignment; Lab While LoopsWhile.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Where we areWhere we are Strings and TextStrings and Text ConditionalsConditionals.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Final Exam ReviewFinal Exam Review –Assessment –Exam Format –C –Matlab.
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam StatusExam Status Recap of Lab 7 ExampleRecap of Lab 7 Example.
March R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Young Scholars GrantsYoung Scholars Grants Exam Next TuesdayExam Next.
1 Lecture 2  Input-Process-Output  The Hello-world program  A Feet-to-inches program  Variables, expressions, assignments & initialization  printf()
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class End of Chapter 2: READ Section 2.15End of Chapter 2: READ Section.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Return HomeworkReturn Homework Class ScheduleClass Schedule Functions:
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Exam ReviewExam Review Arithmetic - I think everyone gets thisArithmetic.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class RecapRecap Functions and CFunctions and C Using FunctionsUsing Functions.
March /20R. Smith - University of St Thomas - Minnesota Today’s Class Recap - simple Java programRecap - simple Java program Revised history of JavaRevised.
C. About the Crash Course Cover sufficient C for simple programs: variables and statements control functions arrays and strings pointers Slides and captured.
Introduction to Computers and Programming - Class 2 1 Introduction to Computers and Programming Class 2 Introduction to C Professor Avi Rosenfeld.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Nested IFNested IF “Boolean” Logical Operations“Boolean” Logical.
6/28/2015 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class History Paper recapHistory Paper recap Finish the movieFinish the movie.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Data IndependenceData Independence Matlab #3: Exercise 5.1Matlab #3:
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Finish up Lab 13Finish up Lab 13 Lab 14 – DetailsLab 14 – Details.
Introduction to C Programming
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class About HomeworkAbout Homework Increment/DecrementIncrement/Decrement.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Homework & GradesHomework & Grades Multiple DimensionsMultiple Dimensions.
March R. Smith - University of St Thomas - Minnesota Today’s Class Homework NotesHomework Notes –Always try to match the printed output if I give.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Change in order of topicsChange in order of topics –Starting Chapter.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class The ExamThe Exam Homework NotesHomework Notes.
Introduction to C Topics Compilation Using the gcc Compiler
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Programming With C.
EPSII 59:006 Spring Introduction to C More Administrative Details The C Programming Language How a computer processes programs Your first C program.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Chapter 2: Java Fundamentals
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
5/27/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class RecapRecap Drawing in 2 dimensionsDrawing in 2 dimensions Vertical HistogramVertical.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Grades & Lab 12Grades & Lab 12 Upcoming ExamUpcoming Exam StructuresStructures.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
1/28/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Assignments 7 and 8Assignments 7 and 8 ExamExam History Paper AssignmentHistory.
2/22/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class History Paper scheduleHistory Paper schedule RecapRecap Plus PlusPlus.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
March R. Smith - University of St Thomas - Minnesota Today’s Class Class StuffClass Stuff ProjectProject Vectors and DimensionsVectors and Dimensions.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Collect PapersCollect Papers Review: Our ZeroesReview: Our Zeroes Review:
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Computer HardwareComputer Hardware Recap: next programRecap: next program.
INC 161 , CPE 100 Computer Programming
Programming what is C++
Chapter 2 - Introduction to C Programming
CS190/295 Programming in Python for Life Sciences: Lecture 1
Presentation transcript:

March R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals –Computer –Program - Sequence –Parts of a computer –Parts of a CPU Writing a really short programWriting a really short program HomeworkHomework

March R. Smith - University of St Thomas - Minnesota I love programming 20 year career, then went into something else20 year career, then went into something else My dad HATED programmingMy dad HATED programming My own kids never really tried itMy own kids never really tried it Some people will find they love itSome people will find they love it Some will hate it, and some are in the middleSome will hate it, and some are in the middle The GOAL: to be capable at programmingThe GOAL: to be capable at programming

March R. Smith - University of St Thomas - Minnesota Class Survey Who is sitting next to you?Who is sitting next to you? Their name? Major?Their name? Major? Why are they taking the course?Why are they taking the course? What computer skills do they bring to this class?What computer skills do they bring to this class?

March R. Smith - University of St Thomas - Minnesota Class Schedule I’ll arrive about 5 minutes early or so every dayI’ll arrive about 5 minutes early or so every day “Lectures” start at 9:55 AM, Tue/Thu“Lectures” start at 9:55 AM, Tue/Thu –Ends at 11:35 “Lab” starts at 10:55 AM M-W-F“Lab” starts at 10:55 AM M-W-F –Ends at Noon Both Lecture and Lab will usually start with a new techniqueBoth Lecture and Lab will usually start with a new technique

March R. Smith - University of St Thomas - Minnesota Syllabus “Real” syllabus tomorrow“Real” syllabus tomorrow Learning C programmingLearning C programming –The basic mechanics –Assignments and variables –Conditionals –Loops –Input/Output –Structure with multiple procedures –Arrays Learning MatlabLearning Matlab –Many of the same concepts –Built in features for mathematical problem solving Lots and lots of programmingLots and lots of programming

March R. Smith - University of St Thomas - Minnesota Grading I do it “by the numbers”I do it “by the numbers” –It’s easy to earn an A-like grade: do the work –It’s easy to flunk: don’t do the work –In between grades: if you skip homework or mess up on exams General outline of the gradeGeneral outline of the grade –Part goes to homework –Part goes to exam (a similar weight) –Part goes to final project I’ll hand out grade sheets with your gradeI’ll hand out grade sheets with your grade NO LATE WORK as a ruleNO LATE WORK as a rule –Need bona fide reason for late work

March R. Smith - University of St Thomas - Minnesota How the class works Memorization and programmingMemorization and programming –This is lots and lots of detail work –You work fast if you work from memory –Practice and remember “patterns” that work Do the Reading!Do the Reading! –It gives you another source for programming details –A different way of describing the same stuff –A place to go to answer questions –“Some” problem sets based on the reading Labs = programming tasks to doLabs = programming tasks to do –Try to finish DURING lab –If you don’t, then you have extra homework

March R. Smith - University of St Thomas - Minnesota Fundamentals ComputerComputer Program - SequenceProgram - Sequence Parts of a computerParts of a computer –Note they are built hierarchically Parts of a CPUParts of a CPU

March R. Smith - University of St Thomas - Minnesota C Program Always in a fileAlways in a file Always defines a ‘function’ to performAlways defines a ‘function’ to perform Usually the function is named ‘main’Usually the function is named ‘main’ We “compile” it to make it workWe “compile” it to make it work

March R. Smith - University of St Thomas - Minnesota Sample C Program #include #include int main (void) { printf("Hello, world\n"); return 0; return 0;}

March R. Smith - University of St Thomas - Minnesota Observations Case sensitive: match cases “exactly”Case sensitive: match cases “exactly” Program is worked “in order” from start to endProgram is worked “in order” from start to end –“Sequences” are fundamental to computing Curly braces mark “nested” componentsCurly braces mark “nested” components –“Hierarchies” are fundamental to computing Learn the “patterns” of typical programming tasksLearn the “patterns” of typical programming tasks –Setting up the program –Doing output

March R. Smith - University of St Thomas - Minnesota “Compiling” - the mechanics “Command Line” compiling“Command Line” compiling Should work the same on PCs and MacsShould work the same on PCs and Macs You have to “compile” programs to run themYou have to “compile” programs to run them $ gcc hello.c $ You simply command the computer to run the programYou simply command the computer to run the program $ hello Hello, world! $

March R. Smith - University of St Thomas - Minnesota Homework 1.Read Chapters 1 through 3 2.Find a “C compiler” on a computer you can use Already installed on 4th floor OSSAlready installed on 4th floor OSS May be installed on other campus computersMay be installed on other campus computers You can download it and install it at homeYou can download it and install it at home For PC: use MinGW, that’s what’s installed hereFor PC: use MinGW, that’s what’s installed here 3.Write a program that prints your name Ideally, use your U: drive or a USB driveIdeally, use your U: drive or a USB drive 4.Run it and see the result Print the “C” file. Include an explanation of where you compiled and ran it, and note any problems you had.Print the “C” file. Include an explanation of where you compiled and ran it, and note any problems you had.

March R. Smith - University of St Thomas - Minnesota What’s happening next? A “history” of CA “history” of C Overview of Statements and VariablesOverview of Statements and Variables Simple typesSimple types Printing out textPrinting out text The nuts and bolts of compiling programsThe nuts and bolts of compiling programs

March R. Smith - University of St Thomas - Minnesota History of C Interpreting expressions (1940s)Interpreting expressions (1940s) Sort/Merge GeneratorSort/Merge Generator A2 CompilerA2 Compiler FortranFortran AlgolAlgol C

March R. Smith - University of St Thomas - Minnesota Statements and Variables Statements we’ll useStatements we’ll use –“Function declarations” like main Always followed by a pair of parentheses,Always followed by a pair of parentheses, and then curly bracesand then curly braces –Other statements are followed by a “;” –Variable declarations –Assignment statements VariablesVariables –Storage cells in your program –Each one is like a spreadsheet cell, only dumber

March R. Smith - University of St Thomas - Minnesota Variable Naming Naming StructureNaming Structure First character: A-Z, a-z, _ or $First character: A-Z, a-z, _ or $ Remaining: same plus digitsRemaining: same plus digits Style rulesStyle rules Descriptive namesDescriptive names Usually start with lowercase letterUsually start with lowercase letter Camelback: use capitals to mark wordsCamelback: use capitals to mark words itemsOrdered, totalPaymentitemsOrdered, totalPayment DO NOT USE $ to start a nameDO NOT USE $ to start a name

March R. Smith - University of St Thomas - Minnesota “Types” of variables First use: you say the typeFirst use: you say the type int = “integer”int = “integer” signed, no decimal part, less than 2Gsigned, no decimal part, less than 2G ExamplesExamples int sampleInt = 12; sampleInt = 25;

March R. Smith - University of St Thomas - Minnesota Printing The ‘printf()’ functionThe ‘printf()’ function –Syntax of ‘functions’ –Takes 1 or more ‘arguments’ or ‘parameters’ First argument: “format string”First argument: “format string” –A string of characters to print –Embedded ‘signals’ to say what else to print (“%” character) –Each ‘signal’ corresponds to a subsequent parameter Extra parametersExtra parameters –One per format signal

March R. Smith - University of St Thomas - Minnesota Blanks, newlines, tabs “ ““ “ “Hello” “There”“Hello” “There” “Hello There”“Hello There” \n, \t\n, \t

March R. Smith - University of St Thomas - Minnesota Compiling and Running What is really happening?What is really happening? How a program executesHow a program executes Computer ‘Languages’Computer ‘Languages’ InterpetingInterpeting CompilingCompiling Running “real” instructionsRunning “real” instructions What it looks like in RAMWhat it looks like in RAM

March R. Smith - University of St Thomas - Minnesota Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.