Lec4InClass

Lec4InClass - reaches a certain point while execute until a...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Program Announcements Read input file at beginning of program, write file upon exit. Do not read or write in the middle I will test it with expected input. Error- checking can wait for a later program I placed Lab 2 solution, *.h, and Friend.cpp in: /cs/faculty/franklin/labfiles/prog1 What circle? a number (easier for you) part1, part2, part3: All one program
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Friends, Friend
Background image of page 2
How do you know when to use X: if – you *sometimes* want something to happen if – else –When you definitely want one of two things to happen if else if else if else if else – One of many things to happen switch – prettier if else if, single variable compared with its integer or char value
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
When to use X Loop – Keep executing statements over and over again under a certain condition Do while – Want to execute at least once for – You have some loop variable that keeps changing and you stop when it
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: reaches a certain point while execute until a condition is met recursion You have a base case, and every other case can be gradually reduced When to use pointers? Local variable and the lifetime of the object needs to be more than just the function If you dont know how big it is until the program runs You pass an input to a function, and you want the function to change the variables value If you want a single line of code in a loop to be able to allocate memory each iteration Friend contains the data for one friend - pointer Friends list of Friend objects - 1 Circle a list which is a subset of the Friend objects dont know how many - pointer Circles a list of Circle objects 1 does not need to be a pointer head->ge->setNext( head->getNext()->setNext(...
View Full Document

This note was uploaded on 12/27/2011 for the course CMPSC 24 taught by Professor Agrawal during the Fall '09 term at UCSB.

Page1 / 7

Lec4InClass - reaches a certain point while execute until a...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online