Download presentation
Presentation is loading. Please wait.
1
March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The examThe exam –Open book, no notes, like last time Exam TopicsExam Topics –Functions –Structures –Characters –Strings
2
March 2005 2R. Smith - University of St Thomas - Minnesota Functions – types of problems Defining a function versus using a functionDefining a function versus using a function –Syntactic differences Given a function definitionGiven a function definition –Tell me the parameters and types –Tell me the return value Given a problem descriptionGiven a problem description –Write a function that solves it –May or may not need a loop – will probably be really simple ‘Scope’ questions‘Scope’ questions –Given some variables in different programs Tell which affects whichTell which affects which Tell which are visible whereTell which are visible where
3
March 2005 3R. Smith - University of St Thomas - Minnesota Structures – Types of problems Four Steps:Four Steps: –Define, Declare, Initialize, use Define a structure that contains some itemsDefine a structure that contains some items –Example: width, length, 3 letter abbreviation, average size Declare a structure variableDeclare a structure variable Initialize a structureInitialize a structure Write a function that uses data from a structureWrite a function that uses data from a structure
4
March 2005 4R. Smith - University of St Thomas - Minnesota Characters – Types of Problems Character constants vs. string constantsCharacter constants vs. string constants Difference between ‘0’ and integer 0, etc.Difference between ‘0’ and integer 0, etc. Arithmetic and charsArithmetic and chars –What happens if you add a small integer (3) to a letter (A) and then print it out as a character Comparing charactersComparing characters The ctype.h functionsThe ctype.h functions Writing your own character classifierWriting your own character classifier –like isvowel()
5
March 2005 5R. Smith - University of St Thomas - Minnesota Strings – Types of Problems Scanning a string for a key elementScanning a string for a key element –Using a loop to check a character at a time –Looking for ‘null’ to determine the string’s length Comparing two stringsComparing two strings –Comparing the string addresses –Comparing the string contents Using Index ValuesUsing Index Values –Copying a string: one index value Ex: copy whole stringEx: copy whole string –Using 2 index values Ex: copy the first part of a string to somewhere elseEx: copy the first part of a string to somewhere else Ex: append one string to anotherEx: append one string to another –Using 3 index values Ex: copy a substring into a separate stringEx: copy a substring into a separate string
6
March 2005 6R. 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 http://creativecommons.org/licenses/by- sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.