44
1/44 Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q&A Conclusion References Files Vita CSC-201 - Computer Science I Lecture #1: Introduction and Overview Chapters 1 and 2 Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge Dr. Chuck Cartledge August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am August 29, 2016 at 9:33am

CSC-201 - Computer Science I Lecture #1: Introduction …ccartled/Teaching/2016-Fall-TCC/Lectures/001.pdf · Lecture #1: Introduction and Overview Chapters 1 and 2 Dr. Chuck CartledgeDr

  • Upload
    hathuy

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CSC-201 - Computer Science ILecture 1 Introduction and Overview

Chapters 1 and 2

Dr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck CartledgeDr Chuck Cartledge

August 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933amAugust 29 2016 at 933am

244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Table of contents I1 Schedule

2 Overview

3 Chapters 1 amp 2

4 Break

5 CodeLab

6 CodeBlock

7 Hands on

8 Q amp A

9 Conclusion

10 References

11 Files

12 Vita

344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Schedule for the semester

Wk Date Topic Wk Date Topic1 0822 Chap 1 ndash 2 9 1017 Chap 102 0829 Chap 3 ndash 4 10 1031 Chap 10 ndash 113 0905 Chap 5 11 1031 Chap 10 ndash 114 0912 Test ndash Chap 6 12 1107 Testndash Chap 145 0919 Chap 7 13 1114 Chap 146 0926 Chap 8 14 1128 Chap 187 1003 Chap 9 15 1205 Chap 188 1010 Test ndash Chap 10 16 1212 Exam

444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Some reasons are obvious others not so much

1 The course is a requirement

2 The language is common

3 The language has interestingfeatures

4 Understanding the languagehelps with other languages

544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Same image

644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Computer languages are not static

Languages are created and evolveto meet new needsLanguages have some underlyingcommon factors because they allrun on computers

Image from [1]

httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Table of contents I1 Schedule

2 Overview

3 Chapters 1 amp 2

4 Break

5 CodeLab

6 CodeBlock

7 Hands on

8 Q amp A

9 Conclusion

10 References

11 Files

12 Vita

344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Schedule for the semester

Wk Date Topic Wk Date Topic1 0822 Chap 1 ndash 2 9 1017 Chap 102 0829 Chap 3 ndash 4 10 1031 Chap 10 ndash 113 0905 Chap 5 11 1031 Chap 10 ndash 114 0912 Test ndash Chap 6 12 1107 Testndash Chap 145 0919 Chap 7 13 1114 Chap 146 0926 Chap 8 14 1128 Chap 187 1003 Chap 9 15 1205 Chap 188 1010 Test ndash Chap 10 16 1212 Exam

444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Some reasons are obvious others not so much

1 The course is a requirement

2 The language is common

3 The language has interestingfeatures

4 Understanding the languagehelps with other languages

544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Same image

644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Computer languages are not static

Languages are created and evolveto meet new needsLanguages have some underlyingcommon factors because they allrun on computers

Image from [1]

httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Schedule for the semester

Wk Date Topic Wk Date Topic1 0822 Chap 1 ndash 2 9 1017 Chap 102 0829 Chap 3 ndash 4 10 1031 Chap 10 ndash 113 0905 Chap 5 11 1031 Chap 10 ndash 114 0912 Test ndash Chap 6 12 1107 Testndash Chap 145 0919 Chap 7 13 1114 Chap 146 0926 Chap 8 14 1128 Chap 187 1003 Chap 9 15 1205 Chap 188 1010 Test ndash Chap 10 16 1212 Exam

444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Some reasons are obvious others not so much

1 The course is a requirement

2 The language is common

3 The language has interestingfeatures

4 Understanding the languagehelps with other languages

544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Same image

644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Computer languages are not static

Languages are created and evolveto meet new needsLanguages have some underlyingcommon factors because they allrun on computers

Image from [1]

httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Some reasons are obvious others not so much

1 The course is a requirement

2 The language is common

3 The language has interestingfeatures

4 Understanding the languagehelps with other languages

544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Same image

644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Computer languages are not static

Languages are created and evolveto meet new needsLanguages have some underlyingcommon factors because they allrun on computers

Image from [1]

httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Same image

644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Computer languages are not static

Languages are created and evolveto meet new needsLanguages have some underlyingcommon factors because they allrun on computers

Image from [1]

httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Computer languages are not static

Languages are created and evolveto meet new needsLanguages have some underlyingcommon factors because they allrun on computers

Image from [1]

httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Comparing various known languages

Each language is reflection of thecurrent state of the art in solvinga particular type of problemYou can expect to learn and usemany different languages overthe course of your career andsupporting different programmingparadigms

httphyperpolyglotorg

Use Hyperployglotorg as a language cross reference

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Hammer and nails

ldquo it is temptingif the only tool youhave is a hammer totreat everything as if itwere a nailrdquo

Abraham H Maslow [4]

Image from [9]

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Why are we here

Socratic method (part of your grade)

The Socraticmethod includes theuse of systematicquestioning inductivereasoning universaldefinitions and adisavowal of knowledge

James C Overholser [5]

Figure ldquoJust one more question rdquo

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What is computer programming

Computer programming iscreating a series of steps for acomputer to execute to achieve aresult

Image from [8]

Computers are really really stupid but fast

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to getdone not howAlgorithms can be time ormemory efficient Good ones areboth

Image from [2]

Start with easy algorithms first

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

How does a computer ldquorunrdquo a program

There are lots of steps in theprocess

1 A human has tounderstand the problem

2 A human selects theappropriate algorithm

3 A human selects theappropriate language

4 A human writes thenecessary steps in the

language (source code)

5 A compiler translates thesource code into objectcode

6 The computer loads theobject code

7 The computer startsprogram execution at aldquowell knownrdquo spot in theobject code

Only the last two steps are fast

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

What wersquoll do

1 Wersquoll address a problem

2 Wersquoll may or may not use an algorithm

3 Wersquoll use C++

4 Wersquoll use the CodeBlock IDE to edit compile and run ourprogram

5 Wersquoll learn new parts of the language

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLCmodelsFor our purposes wersquoll focus on

1 Problem solving(requirements and design)

2 Implementation(construction andverification)

3 Maintenance

Image from [3]

All models have these phases

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design

Analyze the problem and specify what the solution must do

Develop an algorithm to solve the problem

Verify that your solution really solves the problem

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results

Debugging your program to identify and correct errors

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirementsor correct errors that show up in using it

Maintenance begins when your program is put into use andaccounts for the majority of effort on most programs

Wholly rewriting program with a clear design sometimes auseful alternative to modifying the existing program to meetchanging requirements

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part ofearly (and some current)computers

Grace Hopper found a mothstuck between the relaycontacts

Bug was removed from thecomputer and the programworked

Image from [10]

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

1944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 1

Whats inside a computer

Things that are common to all digital computers

A way to input and outputdata

A central processing unit(CPU)

Memory (volatile andnon-volatile)

A language the CPUunderstands

The language is composedof binary values Topics of CSC-205 and CSC-215

Other computer types have similar components

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Elements of C++ programs

Every program must have a mainfunction that returns an integer

Every identifier is composed ofletters numbers or underscoresand must start with a letter orunderscore

Identifiers are case sensitive

Open and closing curly bracesdefine a context and may benested

There are a limited number ofbuilt-in data types

Assignments to identifiers areidentifier = expression

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3

int a = 3

const int a = 3

name = Samatha

string name = Samantha

const string name = Samantha

fullName = name + Bee

f = ampmain

c = (f)()

The last two are more advanced

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

How to get values in and out

C++ requires a preprocessor directive to include the ability toinput and output values

includeltiostreamgt

Once we include the directive we can output values

stdcout ltlt rsquorsquoHello worldrsquorsquo ltlt stdendl

stdcout ltlt thisIsA_variable ltlt anotherVariable ltlt stdendl

And we can input values into variables

stdcin gtgt anInt

stdcin gtgt aString

The ldquostdrdquo refers to a namespace Wersquoll talk about that later

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Built-in data types

All other types are user-definedand brought in via preprocessordirectives

signed is default unsignedmust be specified

short is at least 16 bits wide

long is at least 32 bits

long long is at least 64 bits

Image from [7]

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Same image

Image from [7]

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of thefundamental types are collectively known as data model Four datamodels found wide acceptance

32 bit systems

LP32 or 244 (int is 16-bit long and pointer are 32-bit)(Win16 API)ILP32 or 444 (int long and pointer are 32-bit) (Win32 APIUnix and Unix-like systems)

64 bit systems

LLP64 or 448 (int and long are 32-bit pointer is 64-bit)(Win64 API)LP64 or 488 (int is 32-bit long and pointer are 64-bit)(Unix and Unix-like systems)

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Break time

Take about 10 minutes

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeLab main screen

Is available via the InternetPassword is TIDEWA-8886-0

https

codelab3turingscraftcomcodelabjsplogin1jsp

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

https

codelab3turingscraftcomcodelabjsplogin1jsp

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

2944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyonersquosmachine

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Open a file for editing

We will be using standalone filesNot projectsMost files will be attached to apresentation

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

A file will appear in a tab

Most of our coding andexploration will be using only afew files

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3544

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler willappear in the ldquoBuild messagesrdquotab

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3644

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Same image

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3744

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running

1 firstonecpp

2 errorcpp

3 leapYearcpp

4 dinnercpp

5 greetcpp

Others if you have time

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3844

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Q amp A time

ldquorsquoThe Answer to the GreatQuestion Of Life the Universeand Everything is forty-tworsquo said DeepThought with infinite majestyand calmrdquoDouglas Adams TheHitchhikerrsquos Guide to theGalaxy

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

3944

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

What have we covered

Why are we hereWhere wersquore goingHow wersquoll get thereBasic ideas of computerprogrammingHands on programming withCodeLab and CodeBlock

Next time Chapters 3 amp 4

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

4044

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References I

[1] Sebastian Anthony The evolution of computer languages(infographic)httpwwwextremetechcomcomputing91572-the-

evolution-of-computer-languages-infographic 2011

[2] Owen Astrachan Bubble sort an archaeological algorithmicanalysis ACM SIGCSE Bulletin vol 35 ACM 2003 pp 1ndash5

[3] Eric Johnson Secure software development lifecycle overviewhttps

software-securitysansorgblog20150407

secure-software-development-lifecycle-overview2015

[4] Abraham H Maslow The psychology of science HenryRegency 1966

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

4144

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References II

[5] James C Overholser Elements of the socratic method Vself-improvement Psychotherapy Theory Research PracticeTraining 33 (1996) no 4 549

[6] Sylvia Sorkin Programming and problem solving with c++Teacher Resource Jones and Barlett Learning 2014

[7] C++ Staff Fundamental typeshttpencppreferencecomwcpplanguagetypes2016

[8] Derivativesinvesting Staff Qc 7 toolshttpwwwderivativesinvestingnetarticle

277260716qc-7-tools 2016

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

4244

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

References III

[9] Happiness Staff Abraham maslowhttpwwwpursuit-of-happinessorghistory-of-

happinessabraham-maslow 2016

[10] Wikipedia Staff Grace hopperhttpsenwikipediaorgwikiGrace_Hopper 2016

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

4344

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Files of interest

1 areacpp

2 chessboardcpp

3 dinner2cpp

4 dinnercpp

5 errorcpp

6 firstonecpp

7 greet2cpp

8 greetcpp

9 leapYearcpp

10 raincpp

11 rainin

12 rhymecpp

13 shellcpp

14 wrapcpp

15 ProgramCourseGuide 880-01pdf

areacpp

Program Area calculates the area of a square
The user is prompted to enter the number of inches on each
side Note that ldquoendlrdquo in line 7 ends in the letter ldquolrdquo not
the number one

include lt iostream gt
using namespace std
int main ()

int inches

cout ltlt Enter the number of inches on a side
ltlt endl
cout ltlt Press the return key
ltlt endl
cin gtgt inches
cout ltlt endl
ltlt The area is ltlt inches inches ltlt
ltlt endl
return 0

Nell Drake and Chip Weems

chessboardcpp


Chessboard program
This program prints a chessboard pattern that is built up from
basic strings of white and black characters


include lt iostream gt
include lt string gt

using namespace std


const string BLACK = Define a line of a black square
const string WHITE = Define a line of a white square

int main ()

string whiteRow A row beginning with a white square
string blackRow A row beginning with a black square

Create a white-black row by concatenating the basic strings
whiteRow = WHITE + BLACK + WHITE + BLACK +
WHITE + BLACK + WHITE + BLACK

Create a black-white row by concatenating the basic strings
blackRow = BLACK + WHITE + BLACK + WHITE +
BLACK + WHITE + BLACK + WHITE

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

Print five white-black rows
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl
cout ltlt whiteRow ltlt endl

Print five black-white rows
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl
cout ltlt blackRow ltlt endl

return 0



Nell Drake and Chip Weems

dinner2cpp

Program Dinner prints out a dinner menu
include lt iostream gt
include lt string gt
using namespace std

const string SALAD = Green Salad
const string MEAT = Chicken Marsala
const string VEGGIE = Carrots with lemon butter
const string STARCH = Mashed potatoes
const string DESSERT = Apple pie

int main ()

string mainCourse

cout ltlt First course ltlt SALAD ltlt endl
mainCourse = MEAT + with + VEGGIE + and
+ STARCH
cout ltlt Main course ltlt mainCourse ltlt endl
cout ltlt Dessert ltlt DESSERT
return 0


Nell Drake and Chip Weems

dinnercpp

Program Dinner prints out a dinner menu 1

const SALAD = Green Salad 2
const MEAT = Chicken Marsala 3
const VEGGIE = Carrots with lemon butter 4
STARCH = Mashed potatoes 5

int main 6

string mainCourse 7

cout ltlt First course ltlt SALAD ltlt endl 8
mainCourse = MEAT + with + VEGGIE + and 9
+ STARCH 10
cout ltlt Main course ltlt mainCourse ltlt endl 11
cout ltlt Dessert ltlt DESSERT 12
13

Nell Drake and Chip Weems

errorcpp

Program Error prints 4 lines on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt This program demonstrates ltlt endl
cout ltlt how a missing semicolon can

cout ltlt cause a problem ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

firstonecpp

This program prints my name on the screen
include lt iostream gt
using namespace std

int main ()

cout ltlt ltlt endl
cout ltlt My name is
cout ltlt Nell Dale ltlt endl
cout ltlt ltlt endl
return 0

Nell Drake and Chip Weems

greet2cpp

Program Greet prints a greeting on the screen
include lt iostream gt
include lt string gt
using namespace std

const string FIRST_NAME = Sarah
const string LAST_NAME = Sunshine
int main ()

string message
string name

name = FIRST_NAME + + LAST_NAME
message = Good morning + + name +
cout ltlt message ltlt endl
return 0

Nell Drake and Chip Weems

greetcpp

Program Greet prints a greeting on the screen

_________
_________
using namespace std

_________ string FIRST_NAME = Sarah
_________ string LAST_NAME = Sunshine
_____ _______ ()

_______ message
_______ name

name = FIRST_NAME + + LAST_NAME
message = Good morning __________ name +
cout ltlt message _______ endl
_______ 0


Nell Drake and Chip Weems

leapYearcpp


LeapYear program
This program inputs a year and prints whether the year
is a leap year or not


include lt iostream gt Access output stream

using namespace std

bool IsLeapYear ( int year ) Prototype for subalgorithm

int main ()

int year Year to be tested
cout ltlt Enter a year AD for example 1997
ltlt endl Prompt for input
cin gtgt year Read year

if ( IsLeapYear ( year )) Test for leap year
cout ltlt year ltlt is a leap year ltlt endl
else
cout ltlt year ltlt is not a leap year ltlt endl

return 0 Indicate successful completion




bool IsLeapYear ( int year )
IsLeapYear returns true if year is a leap year and
false otherwise

if ( year 4 = 0 ) Is year not divisible by 4
return false If so cant be a leap year
Must be divisible by 4 at this point
if ( year 100 = 0 ) Is year not a multiple of 100
return true If so is a leap year
Must be divisible by 100 at this point
if ( year 400 = 0 ) Is year not a multiple of 400
return false If so then is not a leap year
Must be divisible by 400 at this point
return true Is a leap year




Nell Drake and Chip Weems

raincpp

Program Rain calculates the average rainfall over a period
of days The number of days and the rain statistics are in
file Rainin

include lt iostream gt
include lt fstream gt
include lt iomanip gt
using namespace std

int GetInches ( ifstream amp rainFle int numberOfDays )
Function returns the total inches of rain
Pre File rainFile has been opened numberOfDays is the
first value on the file followed by numberOfDays
real values representing inches of rain

int main ()

float average Average rainfall
float totalRain Total accumulated rain
int numberOfDays Number of days in calculation
ifstream rainFile Data file

cout ltlt fixed ltlt showpoint
rainFile open ( RainIn )
rainFile gtgt numberOfDays
totalRain = GetInches ( rainFile numberOfDays )

if ( totalRain == 00 )
cout ltlt There was no rain during this period ltlt endl
else

average = totalRain numberOfDays
cout ltlt The average rain fall over
ltlt numberOfDays
cout ltlt days is ltlt setw ( 1 ) ltlt setprecision ( 3 )
ltlt average ltlt endl

return 0




int GetInches ( ifstream amp rainFile int numberOfDays )

float inches Days worth of rain
int counter Loop control variable
float totalRain = 00
counter = 1
while ( counter lt= numberOfDays )

rainFile gtgt inches
totalRain = totalRain + inches
counter ++

return totalRain


Nell Drake and Chip Weems

513231300130113111321

Nell Drake and Chip Weems

rhymecpp

Program Rhyme prints out a nursery rhyme

include lt iostream gt
include lt string gt
using namespace std

const char SEMI_COLON =
const string VERB1 = went up
const string VERB2 = down came
const string VERB3 = washed
const string VERB4 = out came
const string VERB5 = dried up

int main ()

string firstLine
string secondLine
string thirdLine
string fourthLine

firstLine = The itsy bitsy spider + VERB1 +
the water spout
secondLine = VERB2 + the rain and + VERB3 +
the spider out
thirdLine = VERB4 + the sun and + VERB5 +
all the rain
fourthLine = and the itsy bitsy spider + VERB1 +
the spout again

cout ltlt firstLine ltlt SEMI_COLON ltlt endl
cout ltlt secondLine ltlt SEMI_COLON ltlt endl
cout ltlt thirdLine ltlt SEMI_COLON
cout ltlt endl
cout ltlt fourthLine ltlt ltlt endl
return 0

Nell Drake and Chip Weems

shellcpp

int main ()

return 0

Nell Drake and Chip Weems

wrapcpp

Program Wrap writes out the contents of a sandwich wrap
include lt iostream gt
include lt string gt
using namespace std

const string TUNA = tuna
const string PICKLE = pickle
const string LETTUCE = lettuce
const string WRAP = tortilla

int main ()

string filling
string wrap

filling = TUNA + and + PICKLE + with + LETTUCE
wrap = filling + in + WRAP +
cout ltlt Filling ltlt filling ltlt endl
cout ltlt Wrap ltlt wrap ltlt endl

return 0


Nell Drake and Chip Weems

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

Name ________________________________________

SIS Empl ID __________________________________

Date Entered TCC ______________________________

Counselor ____________________________________

Official Curriculum Guide

The Associate of Science (AS) degree in Science with a Specialization in Computer Science is designed for studentswho plan to transfer to a four-year college or university to pursue a baccalaureate degree in computer science Thisdegree program also meets the needs of students seeking teacher certification in secondary mathematics or computerscience

Computer Science courses required for the Computer Science specialization are offered at the Virginia Beach andChesapeake campuses

Associate of Science Science (Computer Science)(880-01)

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 1Co-Requisites

___________NoneCSC 110 ( )Introduction to Computing 3 Placement into MTH173

___________NoneENG 111 ( )College Composition I 3 Qualifying PlacementTest score ENF 1ENF 2 or equivalent

___________NoneMTH 173 ( )Calculus with Analytic GeometryI

5 Qualifying PlacementTest score MTH 164or MTH 166

___________NoneSDV 100 ( )College Success Skills (or SDV101)

1 None

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 15

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 2Co-Requisites

___________NoneCSC 201 ( )Computer Science I 4 CSC 110

___________NoneENG 112 ( )College Composition II 3 ENG 111 orequivalent and abilityto use wordprocessing software

___________NoneMTH 174 ( )Calculus with Analytic GeometryII

4 MTH 173 orequivalent

______________________ ( )History Elective 2 3 Placement into ENG111

Semester Total 14

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 205 ( )Computer Organization 3 CSC 110

08222016

Tidewater Community College Page 1 of 2 Catalog 2016 - 2017

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 3Co-Requisites

___________NoneCSC 210 ( )Programming With C++ 4 CSC 201 or EGR 125

______________________ ( )HealthPhysical EducationElective 4

2

______________________ ( )Science with Lab Elective 1 4

______________________ ( )Social Science Elective 1 3

Semester Total 16

Course No Course Title Credits Prerequisites When Taken Grade

SEMESTER 4Co-Requisites

___________NoneCSC 215 ( )Advanced ComputerOrganization

3 CSC 205

______________________ ( )Approved Elective 3 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Humanities Elective 1 3

______________________ ( )Science with Lab Elective 1 4

Semester Total 16

Total Minimum Credits 611

Eligible courses are listed on page 35 in the 2016-2017 catalog See your academic advisor or counselor to choose theappropriate course(s) Sequenced lab courses are required in natural and physical sciences and ENV 121-122 is not anacceptable sequence

2Students may select any of the following courses to meet this requirement HIS 101 102 111 112 121 or 122

3The Approved Electives may be satisfied with any mathematics natural science social science humanities or foreign languageelectives listed on page 35 of the 2016-2017 catalog Additional course options are provided on the advising transcript in theStudent Information System andor through consultation with a counselor or academic advisor

4Students may select any of the following courses to meet this requirement DIT 121 125 HLT 100 105 106 110 116 121 130138 141 150 160 200 204 215 PED (any activity course)

08222016

Tidewater Community College Page 2 of 2 Catalog 2016 - 2017

TCC Staff

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita

4444

Schedule Overview Chapters 1 amp 2 Break CodeLab CodeBlock Hands on Q amp A Conclusion References Files Vita

Who am I

Father

Husband

PhD Computer Science 2014

CAPT USN retired 2004 (31+years)

A perennial student

1st computer 1970 donated ICBMguidance computer machine codepapermylar tape and drummemory

Interests autonomic systems realndashtime applications distributedprocessing long-term preservation of digital data Big Data

  • Schedule
  • Overview
    • Why are we here
      • Chapters 1 amp 2
        • Chapter 1
        • Chapter 2
          • Break
          • CodeLab
          • CodeBlock
          • Hands on
          • Q amp A
          • Conclusion
          • References
          • Files
          • Vita