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.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Introduction to C Systems Programming Concepts. Introduction to C A simple C Program A simple C Program –Variable Declarations –printf ( ) Compiling and.
March R. Smith - University of St Thomas - Minnesota Today’s Class Quiz RecapQuiz Recap Exam ReviewExam Review C MaterialC Material Matlab MaterialMatlab.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Lab Status?Lab Status? Stuff from the readingStuff from the reading.
Variables Pepper. Variable A variable –box –holds a certain type of value –value inside the box can change Example –A = 2B+1 –Slope = change in y / change.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Tomorrow’s ExamTomorrow’s Exam Today’s LabToday’s Lab SortingSorting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Three exam questionsThree exam questions Lab with filesLab with.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Reading numbers from dialogsReading numbers from dialogs Converting.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class More about FunctionsMore about Functions RecursionRecursion.
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 QMCS 230: Today in Class Hard Drives – more laterHard Drives – more later MethodsMethods.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam TopicsExam Topics.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class The project assignment, againThe project assignment, again Arrays.
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.
March R. Smith - University of St Thomas - Minnesota Today’s Class Program LayoutProgram Layout Problem SolvingProblem Solving Reading InputReading.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Class on Wednesday – “Lab time” in OSS 230Class on Wednesday – “Lab.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class GradingGrading The examThe exam Sorting arraysSorting arrays Pointers,
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.
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 /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class I/O ObjectsI/O Objects Lab 12Lab 12.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Young Scholars GrantsYoung Scholars Grants Exam Next TuesdayExam Next.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Today’s LabToday’s Lab SortingSorting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Reviewing previous workReviewing previous work Using a dialog boxUsing.
March R. Smith - University of St Thomas - Minnesota CISC Class Today Return Homework; grading recapReturn Homework; grading recap “Enigma”
March /18R. Smith - University of St Thomas - Minnesota QMCS 230 – Today in Class Getting Homework BackGetting Homework Back DecimalFormat class.
6/22/2015 1R. Smith - University of St Thomas - Minnesota QMCS Class Today St. Lukes Case StudySt. Lukes Case Study.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Return HomeworkReturn Homework Class ScheduleClass Schedule Functions:
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 Upcoming Exam – April 8Upcoming Exam – April 8 Structures ReviewStructures.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class RecapRecap Functions and CFunctions and C Using FunctionsUsing Functions.
March R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Lab Status, Paper StatusLab Status, Paper Status Comments on Ints vs.
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 StatusStatus –Survey –Returning homework ArraysArrays –What are they?
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.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The examThe exam –Open book, no notes, like last time Exam TopicsExam.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Administrative: do you want another lab?Administrative: do you want.
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.
Basic Elements of C++ Chapter 2.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
9/21/2015 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class RecapRecap Files, writing filesFiles, writing files 1D Array Recap1D.
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
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.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Grades & Lab 12Grades & Lab 12 Upcoming ExamUpcoming Exam StructuresStructures.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class A note on methodsA note on methods ObjectsObjects Creating your.
Variables 1. What is a variable? Something whose value can change over time This value can change more than once over the time period (no limit!) Example:
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.
1/31/2016 1R. Smith - University of St Thomas - Minnesota CISC Today’s Class RecapRecap Problem 11Problem 11 Problem 12Problem 12.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
2/22/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class History Paper scheduleHistory Paper schedule RecapRecap Plus PlusPlus.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class What’s on the Exam Next Week?What’s on the Exam Next Week? Lab 8Lab.
Literals A literal (sometimes called a constant) is a symbol which evaluates to itself, i.e., it is what it appears to be. Examples: 5 int literal
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.
Chapter Topics The Basics of a C++ Program Data Types
Introduction to Computer Science / Procedural – 67130
Basic Elements of C++.
Basic Elements of C++ Chapter 2.
Homework Applied for cs240? (If not, keep at it!) 8/10 Done with HW1?
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
COMPUTING.
Presentation transcript:

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 Recap Character I/ORecap Character I/O The getline() functionThe getline() function Converting stringsConverting strings Plus PlusPlus Plus

The History Paper Assignment A “short research paper”A “short research paper” –I’m expecting about 2 pages (1 is too short, 3 may be too long) –Do RESEARCH. In other words, LOOK FOR INFORMATION You will report on a dispute in computer historyYou will report on a dispute in computer history –The field is new enough that people don’t agree on what happened, who was first, or what people did. –Find a dispute, document both sides of it, and write it up A good grade = doing the assignmentA good grade = doing the assignment 6/28/2015 2R. Smith - University of St Thomas - Minnesota

Now, the movie Pay attention – it’s less reading you’ll have to do for the paper.Pay attention – it’s less reading you’ll have to do for the paper. The MovieThe Movie –It’s from 1995 – so it misses some modern things 6/28/2015 3R. Smith - University of St Thomas - Minnesota

Recap: Character I/O Character variables - declarationCharacter variables - declaration char c; // a character variable char str[] = “A string”;// string var Character constants – formatCharacter constants – format –Single quotes, NOT double quotes: c = ‘3’; // literal 3 character c = ‘\n’; // newline character c = ‘\’ ’; // single quote Two basic I/O functionsTwo basic I/O functions –getchar() – returns next character (no arguments) –putchar(c) – outputs character passed as argument (no return) 6/28/2015 4R. Smith - University of St Thomas - Minnesota

6/28/2015 5R. Smith - University of St Thomas - Minnesota An I/O Loop char ch; // scratch variable /* copy chars as sentinel */ ch = getchar(); while (ch != { putchar(ch); ch = getchar(); }

6/28/2015 6R. Smith - University of St Thomas - Minnesota Char I/O Flow Chart The first block and the diamond form the ‘while’The first block and the diamond form the ‘while’ –We do the calculations and perform the test FIRST Inside of Loop: 2 blocksInside of Loop: 2 blocks –Repeat the blocks after performing the ‘while’ test –First block prints latest char –Second block reads next char ch = getchar(); ch != putchar(ch); False True Done ch = getchar();

Using the getline() function Function fills the next line into a stringFunction fills the next line into a string Arguments:Arguments: –String array –Integer: #chars in the array Return: nothingReturn: nothing How does it return a string?How does it return a string? –it doesn’t – the string is an argument How are we changing an argument?How are we changing an argument? –an array is a special type of variable How do we write getline() ?How do we write getline() ? 6/28/2015 7R. Smith - University of St Thomas - Minnesota

Types and Conversion We’ve done ‘casting’We’ve done ‘casting’ –Put the type you want in front of the variable you have int x; double y; y = 100 / (double) x; We need to do more when converting stringsWe need to do more when converting strings –This does NOT work: y = (double) “100” / x; 6/28/2015 8R. Smith - University of St Thomas - Minnesota

6/28/2015 9R. Smith - University of St Thomas - Minnesota Converting Text to Integer How does ‘getint()’ work?How does ‘getint()’ work? –Let’s write our own: ‘ch2int()’ that takes a string as input The calculation is simpleThe calculation is simple –Convert a number from left to right; use a running total –Multiply the running total by 10 for the ‘tens place’ –Get the ‘ones place’ by subtracting ‘0’ from the character –Add them together for the new running total It looks like the calculation does nothingIt looks like the calculation does nothing –In fact, it’s internally converting the sequence of characters to an integer value

6/28/ R. Smith - University of St Thomas - Minnesota Coding the conversion Variables: total, ones, tensVariables: total, ones, tens Loop while there are digitsLoop while there are digits –Multiply last result by 10 to get ‘tens’ –Subtract ‘0’ from next digit to get the ‘ones’ –Add ‘ones’ and ‘tens’ to get the running total When out of digits, return the totalWhen out of digits, return the total Simplification: how do we make the algebra easier? Can we simplify the calculation?Simplification: how do we make the algebra easier? Can we simplify the calculation?

Plus Plus OPTIONAL shortcuts in COPTIONAL shortcuts in C We can add doubled operators to increment or decrement variables:We can add doubled operators to increment or decrement variables:X++X-- All operators work in assignment statementsAll operators work in assignment statements X += 10 // adds 10 to x Y /= 10 // divides Y by 10

6/28/ 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.