Presentation is loading. Please wait.

Presentation is loading. Please wait.

March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab.

Similar presentations


Presentation on theme: "March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab."— Presentation transcript:

1 March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab 2 introductionLab 2 introduction

2 March 2005 2R. Smith - University of St Thomas - Minnesota Lab 1 Comments IssuesIssues –Mostly the program formatting – letting statements ‘wrap around’ and making it harder to follow. Reformat your printf() statements to be shorterReformat your printf() statements to be shorter Break the strings in 2 parts, put in separate printfs()Break the strings in 2 parts, put in separate printfs() Be sure to match up the variables with the %s markersBe sure to match up the variables with the %s markers –The final ‘s on the shopper’s name –Newlines in the wrong place: replicate the format –“He” and “she” variables instead of “name” and “pronoun” Be sure to substitute all the pronounsBe sure to substitute all the pronouns Don’t mix up the pronoun and name usageDon’t mix up the pronoun and name usage Time today to ‘fix’ Lab 1Time today to ‘fix’ Lab 1 –But first...

3 March 2005 3R. Smith - University of St Thomas - Minnesota Data Types in Chapter 4 Did anyone figure out what these were:Did anyone figure out what these were: –Octal, hexadecimal Why are there all of these different types?Why are there all of these different types? Why aren’t ‘strings’ listed?Why aren’t ‘strings’ listed?

4 March 2005 4R. Smith - University of St Thomas - Minnesota Lab 2 Start with 4 integersStart with 4 integers –Pairs of coordinates for a rectangle’s opposite corners –x1, y1, x2, y2 –1 is lower left corner, 2 is upper right. Calculate the followingCalculate the following –Horizontal length –Vertical length –Average length –Perimeter –Area Anyone remember junior high geometry?Anyone remember junior high geometry?

5 March 2005 5R. Smith - University of St Thomas - Minnesota Making it work Declare the 4 corners and initialize themDeclare the 4 corners and initialize them –Pick your own values. Do Not repeat the example values. –Note the limitation: lengths should be POSITIVE. Declare variables for each resultDeclare variables for each result –Integers and doubles –Pick appropriate types Calculate each resultCalculate each result Use integer or double output with printf() as appropriate to display each resultUse integer or double output with printf() as appropriate to display each result E-mail me the.C file as an attachmentE-mail me the.C file as an attachment

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.


Download ppt "March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab."

Similar presentations


Ads by Google