Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
|
|
- Richard Lawson
- 5 years ago
- Views:
Transcription
1
2 Chapter 6 I/O Streams as a Itroductio to Objects ad Classes
3 Overview 6.1 Streams ad Basic File I/O 6.2 Tools for Stream I/O 6.3 Character I/O Slide 6-3
4 6.1 Streams ad Basic File I/O
5 I/O Streams I/O refers to program iput ad output Iput is delivered to your program via a stream object Iput ca be from The keyboard A file Output is delivered to the output device via a stream object Output ca be to The scree A file Slide 6-5
6 Objects Objects are special variables that Have their ow special-purpose fuctios Set C++ apart from earlier programmig laguages Slide 6-6
7 Streams ad Basic File I/O Files for I/O are the same type of files used to store programs A stream is a flow of data. Iput stream: Data flows ito the program If iput stream flows from keyboard, the program will accept data from the keyboard If iput stream flows from a file, the program will accept data from the file Output stream: Data flows out of the program To the scree To a file Slide 6-7
8 ci Ad cout Streams ci Iput stream coected to the keyboard cout Output stream coected to the scree ci ad cout defied i the iostream library Use iclude directive: #iclude <iostream> You ca declare your ow streams to use with files. Slide 6-8
9 Why Use Files? Files allow you to store data permaetly! Data output to a file lasts after the program eds A iput file ca be used over ad over No typig of data agai ad agai for testig Create a data file or read a output file at your coveiece Files allow you to deal with larger data sets Slide 6-9
10 File I/O Readig from a file Takig iput from a file Doe from begiig to the ed (for ow) No backig up to read somethig agai (OK to start over) Just as doe from the keyboard Writig to a file Sedig output to a file Doe from begiig to ed (for ow) No backig up to write somethig agai( OK to start over) Just as doe to the scree Slide 6-10
11 Stream Variables Like other variables, a stream variable Must be declared before it ca be used Must be iitialized before it cotais valid data Iitializig a stream meas coectig it to a file The value of the stream variable ca be thought of as the file it is coected to Ca have its value chaged Chagig a stream value meas discoectig from oe file ad coectig to aother Slide 6-11
12 Streams ad Assigmet A stream is a special kid of variable called a object Objects ca use special fuctios to complete tasks Streams use special fuctios istead of the assigmet operator to chage values Slide 6-12
13 Declarig A Iput-file Stream Variable Iput-file streams are of type ifstream Type ifstream is defied i the fstream library You must use the iclude ad usig directives #iclude <fstream> usig amespace std; Declare a iput-file stream variable usig ifstream i_stream; Slide 6-13
14 Declarig A Output-file Stream Variable Ouput-file streams of are type ofstream Type ofstream is defied i the fstream library You must use these iclude ad usig directives #iclude <fstream> usig amespace std; Declare a iput-file stream variable usig ofstream out_stream; Slide 6-14
15 Coectig To A File Oce a stream variable is declared, coect it to a file Coectig a stream to a file is opeig the file Use the ope fuctio of the stream object i_stream.ope("ifile.dat"); Period Double quotes File ame o the disk Slide 6-15
16 Usig The Iput Stream Oce coected to a file, the iput-stream variable ca be used to produce iput just as you would use ci with the extractio operator Example: it oe_umber, aother_umber; i_stream >> oe_umber >> aother_umber; Slide 6-16
17 Usig The Output Stream A output-stream works similarly to the iput-stream ofstream out_stream; out_stream.ope("outfile.dat"); out_stream << "oe umber = " << oe_umber << "aother umber = " << aother_umber; Slide 6-17
18 Exteral File Names A Exteral File Name Is the ame for a file that the operatig system uses ifile.dat ad outfile.dat used i the previous examples Is the "real", o-the-disk, ame for a file Needs to match the amig covetios o your system Usually oly used i the stream's ope statemet Oce ope, referred to usig the ame of the stream coected to it. Slide 6-18
19 Closig a File After usig a file, it should be closed This discoects the stream from the file Close files to reduce the chace of a file beig corrupted if the program termiates abormally It is importat to close a output file if your program later eeds to read iput from the output file The system will automatically close files if you forget as log as your program eds ormally Display 6.1 Slide 6-19
20 Objects A object is a variable that has fuctios ad data associated with it i_stream ad out_stream each have a fuctio amed ope associated with them i_stream ad out_stream use differet versios of a fuctio amed ope Oe versio of ope is for iput files A differet versio of ope is for output files Slide 6-20
21 Member Fuctios A member fuctio is a fuctio associated with a object The ope fuctio is a member fuctio of i_stream i the previous examples A differet ope fuctio is a member fuctio of out_stream i the previous examples Slide 6-21
22 Objects ad Member Fuctio Names Objects of differet types have differet member fuctios Some of these member fuctios might have the same ame Differet objects of the same type have the same member fuctios Slide 6-22
23 Classes A type whose variables are objects, is a class ifstream is the type of the i_stream variable (object) ifstream is a class The class of a object determies its member fuctios Example: ifstream i_stream1, i_stream2; i_stream1.ope ad i_stream2.ope are the same fuctio but might have differet argumets Slide 6-23
24 Class Member Fuctios Member fuctios of a object are the member fuctios of its class The class determies the member fuctios of the object The class ifstream has a ope fuctio Every variable (object) declared of type ifstream has that ope fuctio Slide 6-24
25 Callig a Member Fuctio Callig a member fuctio requires specifyig the object cotaiig the fuctio The callig object is separated from the member fuctio by the dot operator Example: i_stream.ope("ifile.dat"); Callig object Member fuctio Dot operator Slide 6-25
26 Member Fuctio Callig Sytax Sytax for callig a member fuctio: Callig_object.Member_Fuctio_Name(Argumet_list); Slide 6-26
27 Errors O Opeig Files Opeig a file could fail for several reasos Commo reasos for ope to fail iclude The file might ot exist The ame might be typed icorrectly May be o error message if the call to ope fails Program executio cotiues! Slide 6-27
28 Catchig Stream Errors Member fuctio fail, ca be used to test the success of a stream operatio fail returs a boolea type (true or false) fail returs true if the stream operatio failed Slide 6-28
29 Haltig Executio Whe a stream ope fuctio fails, it is geerally best to stop the program The fuctio exit, halts a program exit returs its argumet to the operatig system exit causes program executio to stop exit is NOT a member fuctio Exit requires the iclude ad usig directives #iclude <cstdlib> usig amespace std; Slide 6-29
30 Usig fail ad exit Immediately followig the call to ope, check that the operatio was successful: i_stream.ope("stuff.dat"); if( i_stream.fail( ) ) { cout << "Iput file opeig failed.\"; exit(1) ; } Display 6.2 Slide 6-30
31 Techiques for File I/O Whe readig iput from a file Do ot iclude prompts or echo the iput The lies cout << "Eter the umber: "; ci >> the_umber; cout << "The umber you etered is " << the_umber; become just oe lie i_file >> the_umber; The iput file must cotai exactly the data expected Slide 6-31
32 Appedig Data (optioal) Output examples so far create ew files If the output file already cotais data, that data is lost To apped ew output to the ed a existig file use the costat ios::app defied i the iostream library: outstream.ope("importat.txt", ios::app); If the file does ot exist, a ew file will be created Display 6.3 Slide 6-32
33 File Names as Iput (optioal) Program users ca eter the ame of a file to use for iput or for output Program must use a variable that ca hold multiple characters A sequece of characters is called a strig Declarig a variable to hold a strig of characters: char file_ame[16]; file_ame is the ame of a variable Brackets eclose the maximum umber of characters + 1 The variable file_ame cotais up to 15 characters Slide 6-33
34 Usig A Character Strig char file_ame[16]; cout << "Eter the file_ame "; ci >> file_ame; ifstream i_stream; i_stream.ope(file_ame); if (i_stream.fail( ) ) { cout << "Iput file opeig failed.\"; exit(1); } Display 6.4 (1) Display 6.4 (2) Slide 6-34
35 Sectio 6.1 Coclusio Ca you Write a program that uses a stream called fi which will be coected to a iput file ad a stream called fout which will be coected to a output file? How do you declare fi ad fout? What iclude directive, if ay, do you ee to place i your program file? Name at least three member fuctios of a iostream object ad give examples of usage of each? Slide 6-35
36 6.2 Tools for Streams I/O
37 Tools for Stream I/O To cotrol the format of the program's output We use commads that determie such details as: The spaces betwee items The umber of digits after a decimal poit The umeric style: scietific otatio for fixed poit Showig digits after a decimal poit eve if they are zeroes Showig plus sigs i frot of positive umbers Left or right justifyig umbers i a give space Slide 6-37
38 Formattig Output to Files Format output to the scree with: cout.setf(ios::fixed); cout.setf(ios::showpoit); cout.precisio(2); Format output to a file usig the out-file stream amed out_stream with: out_stream.setf(ios::fixed); out_stream.setf(ios::showpoit); out_stream.precisio(2); Slide 6-38
39 out_stream.precisio(2); precisio is a member fuctio of output streams After out_stream.precisio(2); Output of umbers with decimal poits will show a total of 2 sigificat digits e e OR will show 2 digits after the decimal poit e e-4 Calls to precisio apply oly to the stream amed i the call Slide 6-39
40 setf(ios::fixed); setf is a member fuctio of output streams setf is a abbreviatio for set flags A flag is a istructio to do oe of two optios ios::fixed is a flag After out_stream.setf(ios::fixed); All further output of floatig poit umbers Will be writte i fixed-poit otatio, the way we ormally expect to see umbers Calls to setf apply oly to the stream amed i the call Slide 6-40
41 setf(ios::showpoit); After out_stream.setf(ios::showpoit); Output of floatig poit umbers Will show the decimal poit eve if all digits after the decimal poit are zeroes Display 6.5 Slide 6-41
42 Creatig Space i Output The width fuctio specifies the umber of spaces for the ext item Applies oly to the ext item of output Example: To prit the digit 7 i four spaces use out_stream.width(4); out_stream << 7 << edl; Three of the spaces will be blak 7 7 (ios::right) (ios::left) Slide 6-42
43 Not Eough Width? What if the argumet for width is too small? Such as specifyig cout.width(3); whe the value to prit is The etire item is always output If too few spaces are specified, as may more spaces as eeded are used Slide 6-43
44 Usettig Flags Ay flag that is set, may be uset Use the usetf fuctio Example: cout.usetf(ios::showpos); causes the program to stop pritig plus sigs o positive umbers Slide 6-44
45 Maipulators A maipulator is a fuctio called i a otraditioal way Maipulators i tur call member fuctios Maipulators may or may ot have argumets Used after the isertio operator (<<) as if the maipulator fuctio call is a output item Slide 6-45
46 The setw Maipulator setw does the same task as the member fuctio width setw calls the width fuctio to set spaces for output Example: cout << "Start" << setw(4) << 10 << setw(4) << setw(6) << 30; produces: Start Two Spaces Four Spaces Slide 6-46
47 The setprecisio Maipulator setprecisio does the same task as the member fuctio precisio Example: cout.setf(ios::fixed); cout.setf(ios::showpoit); cout << "$" << setprecisio(2) << 10.3 << edl << "$" << 20.5 << edl; produces: $10.30 $20.50 setprecisio settig stays i effect util chaged Slide 6-47
48 Maipulator Defiitios The maipulators setw ad setprecisio are defied i the iomaip library To use these maipulators, add these lies #iclude <iomaip> usig amespace std; Slide 6-48
49 Stream Names as Argumets Streams ca be argumets to a fuctio The fuctio's formal parameter for the stream must be call-by-referece Example: void make_eat(ifstream& messy_file, ofstream& eat_file); Slide 6-49
50 The Ed of The File Iput files used by a program may vary i legth Programs may ot be able to assume the umber of items i the file A way to kow the ed of the file is reached: The boolea expressio (i_stream >> ext) Reads a value from i_stream ad stores it i ext True if a value ca be read ad stored i ext False if there is ot a value to be read (the ed of the file) Slide 6-50
51 Ed of File Example To calculate the average of the umbers i a file double ext, sum = 0; it cout = 0; while(i_stream >> ext) { sum = sum + ext; cout++; } double average = sum / cout; Slide 6-51
52 Stream Argumets ad Namespaces Usig directives have bee local to fuctio defiitios i the examples so far Whe parameter type ames are i a amespace A usig directive must be outside the fuctio so C++ will uderstad the parameter type ames such as ifstream Easy solutio is to place the usig directive at the begiig of the file May experts do ot approve as this does ot allow usig multiple amespaces with ames i commo Slide 6-52
53 Program Example The program i Display 6.6 Takes iput from rawdata.dat Writes output to the scree ad to eat.dat Formattig istructios are used to create a eater layout Numbers are writte oe per lie i a field width of 12 Each umber is writte with 5 digits after the decimal poit Each umber is writte with a plus or mius sig Uses fuctio make_eat that has formal parameters for the iput-file stream ad output-file stream Display 6.6 (1) Display 6.6 (2) Display 6.6 (3) Slide 6-53
54 Sectio 6.2 Coclusio Ca you Show the output produced whe the followig lie is executed? cout << "*" << setw(3) << << "*" edl; Describe the effect of each of these flags? Ios::fixed ios::scietific ios::showpoit ios::right ios::right ios::showpos Slide 6-54
55 6.3 Character I/O
56 Character I/O All data is iput ad output as characters Output of the umber 10 is two characters '1' ad '0' Iput of the umber 10 is also doe as '1' ad '0' Iterpretatio of 10 as the umber 10 or as characters depeds o the program Coversio betwee characters ad umbers is usually automatic Slide 6-56
57 Low Level Character I/O Low level C++ fuctios for character I/O Perform character iput ad output Do ot perform automatic coversios Allow you to do iput ad output i ayway you ca devise Slide 6-57
58 Member Fuctio get Fuctio get Member fuctio of every iput stream Reads oe character from a iput stream Stores the character read i a variable of type char, the sigle argumet the fuctio takes Does ot use the extractio operator (>>) which performs some automatic work Does ot skip blaks Slide 6-58
59 Usig get These lies use get to read a character ad store it i the variable ext_symbol char ext_symbol; ci.get(ext_symbol); Ay character will be read with these statemets Blak spaces too! '\' too! (The ewlie character) Slide 6-59
60 get Sytax iput_stream.get(char_variable); Examples: char ext_symbol; ci.get(ext_symbol); ifstream i_stream; i_stream.ope("ifile.dat"); i_stream.get(ext_symbol); Slide 6-60
61 More About get Give this code: char c1, c2, c3; ci.get(c1); ci.get(c2); ci.get(c3); ad this iput: AB CD c1 = 'A' c2 = 'B' c3 = '\' ci >> c1 >> c2 >> c3; would place 'C' i c3 (the ">>" operator skips the ewlie character) Slide 6-61
62 The Ed of The Lie To read ad echo a lie of iput Look for '\' at the ed of the iput lie: cout<<"eter a lie of iput ad I will " << "echo it.\"; char symbol; do { ci.get(symbol); cout << symbol; } while (symbol!= '\'); All characters, icludig '\' will be output Slide 6-62
63 '\ ' vs "\ " '\' A value of type char Ca be stored i a variable of type char "\" A strig cotaiig oly oe character Caot be stored i a variable of type char I a cout-statemet they produce the same result Slide 6-63
64 Member Fuctio put Fuctio put Member fuctio of every output stream Requires oe argumet of type char Places its argumet of type char i the output stream Does ot do allow you to do more tha previous output with the isertio operator ad cout Slide 6-64
65 put Sytax Output_stream.put(Char_expressio); Examples: cout.put(ext_symbol); cout.put('a'); ofstream out_stream; out_stream.ope("outfile.dat"); out_stream.put('z'); Slide 6-65
66 Member Fuctio putback The putback member fuctio places a character i the iput stream putback is a member fuctio of every iput stream Useful whe iput cotiues util a specific character is read, but you do ot wat to process the character Places its argumet of type char i the iput stream Character placed i the stream does ot have to be a character read from the stream Slide 6-66
67 putback Example The followig code reads up to the first blak i the iput stream fi, ad writes the characters to the file coected to the output stream fout fi.get(ext); while (ext!= ' ') { fout.put(ext); fi.get(ext); } fi.putback(ext); The blak space read to ed the loop is put back ito the iput stream Slide 6-67
68 Program Example Checkig Iput Icorrect iput ca produce worthless output Use iput fuctios that allow the user to re-eter iput util it is correct, such as Echoig the iput ad askig the user if it is correct If the iput is ot correct, allow the user to eter the data agai Slide 6-68
69 Checkig Iput: get_it The get_it fuctio see i Display 6.7 obtais a iteger value from the user get_it prompts the user, reads the iput, ad displays the iput After displayig the iput, get_it asks the user to cofirm the umber ad reads the user's respose usig a variable of type character The process is repeated util the user idicates with a 'Y' or 'y' that the umber etered is correct Slide 6-69
70 Checkig Iput: ew_lie The ew_lie fuctio see i Display 6.7 is called by the get_it fuctio ew_lie reads all the characters remaiig i the iput lie but does othig with them, essetially discardig them ew_lie is used to discard what follows the first character of the the user's respose to get_lie's "Is that correct? (yes/o)" The ewlie character is discarded as well Display 6.7 (1) Display 6.7 (2) Slide 6-70
71 Iheritace ad Output ostream is the class of all output streams cout is of type ostream ofstream is the class of output-file streams The ofstream class is a child class of ostream More about this i Chapter 10 This fuctio ca be called with ostream or ofstream argumets void say_hello(ostream& ay_out_stream) { ay_out_stream << "Hello"; } Slide 10-71
72 Program Example: Aother ew_lie Fuctio The ew_lie fuctio from Display 6.7 oly works with ci This versio works for ay iput stream void ew_lie(istream& i_stream) { char symbol; do { i_stream.get(symbol); } while (symbol!= '\'); } Slide 10-72
73 Program Example: Callig ew_lie The ew versio of ew_lie ca be called with ci as the argumet ew_lie(ci); If the origial versio of ew_lie is kept i the program, this call produces the same result ew_lie( ); New_lie ca also be called with a iput-file stream as a argumet ew_lie(fi); Slide 10-73
74 Default Argumets It is ot ecessary to have two versios of the ew_lie fuctio A default value ca be specified i the parameter list The default value is selected if o argumet is available for the parameter The ew_lie header ca be writte as ew_lie (istream & i_stream = ci) If ew_lie is called without a argumet, ci is used Slide 10-74
75 Multiple Default Argumets Whe some formal parameters have default values ad others do ot All formal parameters with default values must be at the ed of the parameter list Argumets are applied to the all formal parameters i order just as we have see before The fuctio call must provide at least as may argumets as there are parameters without default values Slide 10-75
76 Default Argumet Example void default_args(it arg1, it arg2 = -3) { cout << arg1 << ' ' << arg2 << edl; } default_args ca be called with oe or two parameters default_args(5); //output is 5-3 default_args(5, 6); //output is 5 6 Slide 10-76
77 Checkig Iput: Check for Yes or No? get_it cotiues to ask for a umber util the user respods 'Y' or 'y' usig the do-while loop do { // the loop body } while ((as!='y') &&(as!= 'y') ) Why ot use ((as =='N') (as == '') )? User must eter a correct respose to cotiue a loop tested with ((as =='N') (as == '') ) What if they mis-typed "Bo" istead of "No"? User must eter a correct respose to ed the loop tested with ((as!='y') &&(as!= 'y') ) Slide 6-77
78 Mixig ci >> ad ci.get Be sure to deal with the '\' that eds each iput lie if usig ci >> ad ci.get "ci >>" reads up to the '\' The '\' remais i the iput stream Usig ci.get ext will read the '\' The ew_lie fuctio from Display 6.7 ca be used to clear the '\' Slide 6-78
79 '\' Example The Code: cout << "Eter a umber:\"; it umber; ci >> umber; cout << "Now eter a letter:\"; char symbol; ci.get(symbol); The Dialogue: Eter a umber: 21 Now eter a letter: A The Result: umber = 21 symbol = '\' Slide 6-79
80 A Fix To Remove '\' cout << "Eter a umber:\"; it umber; ci >> umber; cout << "Now eter a letter:\"; char symbol; ci >>symbol; Slide 6-80
81 Aother '\' Fix cout << "Eter a umber:\"; it umber; ci >> umber; ew_lie( ); // From Display 6.7 cout << "Now eter a letter:\"; char symbol; ci.get(symbol); Slide 6-81
82 Detectig the Ed of a File Member fuctio eof detects the ed of a file Member fuctio of every iput-file stream eof stads for ed of file eof returs a boolea value True whe the ed of the file has bee reached False whe there is more data to read Normally used to determie whe we are NOT at the ed of the file Example: if (! i_stream.eof( ) ) Slide 6-82
83 Usig eof This loop reads each character, ad writes it to the scree i_stream.get(ext); while (! i_stream.eof( ) ) { cout << ext; i_stream.get(ext); } (! I_stream.eof( ) ) becomes false whe the program reads past the last character i the file Slide 6-83
84 The Ed Of File Character Ed of a file is idicated by a special character i_stream.eof( ) is still true after the last character of data is read i_stream.eof( ) becomes false whe the special ed of file character is read Slide 6-84
85 How To Test Ed of File We have see two methods while ( i_stream >> ext) while (! i_stream.eof( ) ) Which should be used? I geeral, use eof whe iput is treated as text ad usig a member fuctio get to read iput I geeral, use the extractio operator method whe processig umeric data Slide 6-85
86 Program Example: Editig a Text File The program of Display 6.8 Reads every character of file cad.dat ad copies it to file cplusad.dat except that every 'C' is chaged to "C++" i cplusad.dat Preserves lie breaks i cad.dat get is used for iput as the extractio operator would skip lie breaks get is used to preserve spaces as well Uses eof to test for ed of file Display 6.8 (1) Display 6.8 (2) Slide 6-86
87 Character Fuctios Several predefied fuctios exist to facilitate workig with characters The cctype library is required #iclude <cctype> usig amespace std; Slide 6-87
88 The toupper Fuctio toupper returs the argumet's upper case character toupper('a') returs 'A' toupper('a') retur 'A' Slide 6-88
89 toupper Returs A it Characters are actually stored as a iteger assiged to the character toupper ad tolower actually retur the iteger represetig the character cout << toupper('a'); //prits the iteger for 'A' char c = toupper('a'); //places the iteger for 'A' i c cout << c; //prits 'A' cout << static_cast<char>(toupper('a')); //works too Slide 6-89
90 The isspace Fuctio isspace returs true if the argumet is whitespace Whitespace is spaces, tabs, ad ewlies isspace(' ') returs true Example: if (isspace(ext) ) cout << '-'; else cout << ext; Prits a '-' if ext cotais a space, tab, or ewlie character See more character fuctios i Display 6.9 (1) Display 6.9 (2) Slide 6-90
91 Sectio 6.3 Coclusio Ca you Write code that will read a lie of text ad echo the lie with all the uppercase letters deleted? Describe two methods to detect the ed of a iput file: Describe whitespace? Slide 6-91
92 Chapter 6 -- Ed Slide 6-92
93 Display 6.1 Back Next Slide 6-93
94 Display 6.2 Back Next Slide 6-94
95 Display 6.3 Back Next Slide 6-95
96 Display 6.4 (1/2) Back Next Slide 6-96
97 Display 6.4 (2/2) Back Next Slide 6-97
98 Display 6.5 Back Next Slide 6-98
99 Display 6.6 (1/3) Back Next Slide 6-99
100 Display 6.6 (2/3) Back Next Slide 6-100
101 Display 6.6 (3/3) Back Next Slide 6-101
102 Display 6.7 (1/2) Back Next Slide 6-102
103 Display 6.7 (2/2) Back Next Slide 6-103
104 Display 6.8 (1/2) Back Next Slide 6-104
105 Display 6.8 (2/2) Back Next Slide 6-105
106 Display 6.9 (1/2) Back Next Slide 6-106
107 Display 6.9 (2/2) Back Next Slide 6-107
Chapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 2 C++ Basics Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 2.1 Variables ad Assigmets 2.2 Iput ad Output 2.3 Data Types ad Expressios 2.4 Simple Flow of Cotrol 2.5 Program
More informationChapter Overview. I/O Streams as an Introduction to Objects and Classes. I/O Streams. Streams and Basic File I/O. Objects
Chapter 6 I/O Streams as an Introduction to Objects and Classes Overview 6.1 Streams and Basic File I/O 6.2 Tools for Stream I/O 6.3 Character I/O Copyright 2008 Pearson Addison-Wesley. All rights reserved.
More informationChapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 6 I/O Streams as an Introduction to Objects and Classes Overview 6.1 Streams and Basic File I/O 6.2 Tools for Stream I/O 6.3 Character I/O Slide 6-3 6.1 Streams and Basic File I/O I/O Streams I/O
More informationChapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs
More informationChapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationCS 11 C track: lecture 1
CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material
More informationChapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationElementary Educational Computer
Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationn Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis
Overview Chapter 6 Writig a Program Bjare Stroustrup Some thoughts o software developmet The idea of a calculator Usig a grammar Expressio evaluatio Program orgaizatio www.stroustrup.com/programmig 3 Buildig
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More information10/23/18. File class in Java. Scanner reminder. Files. Opening a file for reading. Scanner reminder. File Input and Output
File class i Java File Iput ad Output TOPICS File Iput Exceptio Hadlig File Output Programmers refer to iput/output as "I/O". The File class represets files as objects. The class is defied i the java.io
More informationOne advantage that SONAR has over any other music-sequencing product I ve worked
*gajedra* D:/Thomso_Learig_Projects/Garrigus_163132/z_productio/z_3B2_3D_files/Garrigus_163132_ch17.3d, 14/11/08/16:26:39, 16:26, page: 647 17 CAL 101 Oe advatage that SONAR has over ay other music-sequecig
More informationn Maurice Wilkes, 1949 n Organize software to minimize errors. n Eliminate most of the errors we made anyway.
Bjare Stroustrup www.stroustrup.com/programmig Chapter 5 Errors Abstract Whe we program, we have to deal with errors. Our most basic aim is correctess, but we must deal with icomplete problem specificatios,
More informationCS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June
CS 1313 010: Programmig for No-Majors, Summer 2007 Programmig Project #3: Two Little Calculatios Due by 12:00pm (oo) Wedesday Jue 27 2007 This third assigmet will give you experiece writig programs that
More informationAbstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:
Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values
More informationFrom last week. Lecture 5. Outline. Principles of programming languages
Priciples of programmig laguages From last week Lecture 5 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l ML has o assigmet. Explai how to access a old bidig? Is & for
More informationWORKED EXAMPLE 7.1. Producing a Mass Mailing. We want to automate the process of producing mass mailings. A typical letter might look as follows:
Worked Example 7.1 Producig a Mass Mailig 1 WORKED EXAMPLE 7.1 Producig a Mass Mailig We wat to automate the process of producig mass mailigs. A typical letter might look as follows: To: Ms. Sally Smith
More informationWhat we will learn about this week:
What we will learn about this week: Streams Basic file I/O Tools for Stream I/O Manipulators Character I/O Get and Put EOF function Pre-defined character functions Objects 1 I/O Streams as an Introduction
More informationCS 111: Program Design I Lecture 15: Objects, Pandas, Modules. Robert H. Sloan & Richard Warner University of Illinois at Chicago October 13, 2016
CS 111: Program Desig I Lecture 15: Objects, Padas, Modules Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago October 13, 2016 OBJECTS AND DOT NOTATION Objects (Implicit i Chapter 2, Variables,
More informationChapter 3. More Flow of Control. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 3 More Flow of Cotrol Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 3.1 Usig Boolea Expressios 3.2 Multiway Braches 3.3 More about C++ Loop Statemets 3.4 Desigig Loops Copyright
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig
More informationn The C++ template facility provides the ability to define n A generic facility allows code to be written once then
UCLA PIC 10 B Problem Solvig usig C++ Programmig Ivo Diov, Asst. Prof. i Mathematics, Neurology, Statistics Istructor: Teachig Assistat: Suzae Nezzar, Mathematics Chapter 13 Templates for More Abstractio
More informationtop() Applications of Stacks
CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22
More informationCreating Test Harnesses and Starter Applications
03 6000 ch02 11/18/03 8:54 AM Page 27 Creatig Test Haresses ad Starter Applicatios Applicatio Types You Ca Create with Visual C++ Visual C++.NET comes with a package of wizards that geerate startig code
More informationK-NET bus. When several turrets are connected to the K-Bus, the structure of the system is as showns
K-NET bus The K-Net bus is based o the SPI bus but it allows to addressig may differet turrets like the I 2 C bus. The K-Net is 6 a wires bus (4 for SPI wires ad 2 additioal wires for request ad ackowledge
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More informationRecursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames
Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of
More informationCS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions
CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationExceptions. Your computer takes exception. The Exception Class. Causes of Exceptions
Your computer takes exceptio s s are errors i the logic of a program (ru-time errors). Examples: i thread mai java.io.filenotfoud: studet.txt (The system caot fid the file specified.) i thread mai java.lag.nullpoiter:
More informationCS 111: Program Design I Lecture 16: Module Review, Encodings, Lists
CS 111: Program Desig I Lecture 16: Module Review, Ecodigs, Lists Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago October 18, 2016 Last time Dot otatio ad methods Padas: user maual poit
More informationBasic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.
5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator
More informationWeston Anniversary Fund
Westo Olie Applicatio Guide 2018 1 This guide is desiged to help charities applyig to the Westo to use our olie applicatio form. The Westo is ope to applicatios from 5th Jauary 2018 ad closes o 30th Jue
More informationThe number n of subintervals times the length h of subintervals gives length of interval (b-a).
Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's
More informationGetting Started. Getting Started - 1
Gettig Started Gettig Started - 1 Issue 1 Overview of Gettig Started Overview of Gettig Started This sectio explais the basic operatios of the AUDIX system. It describes how to: Log i ad log out of the
More informationThe Magma Database file formats
The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,
More informationCS211 Fall 2003 Prelim 2 Solutions and Grading Guide
CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece
More informationOverview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup
Chapter 18 Vectors ad Arrays Bjare Stroustrup Vector revisited How are they implemeted? Poiters ad free store Destructors Iitializatio Copy ad move Arrays Array ad poiter problems Chagig size Templates
More informationExercise 6 (Week 42) For the foreign students only.
These are the last exercises of the course. Please, remember that to pass exercises, the sum of the poits gathered by solvig the questios ad attedig the exercise groups must be at least 4% ( poits) of
More informationData diverse software fault tolerance techniques
Data diverse software fault tolerace techiques Complemets desig diversity by compesatig for desig diversity s s limitatios Ivolves obtaiig a related set of poits i the program data space, executig the
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationRecursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:
Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical
More informationLocation Steps and Paths
Locatio Steps ad Paths 3 INTHIS CHAPTER Uderstadig Locatio Steps ad Paths How do locatio paths work? We took a look at locatio paths i the overview i Chapter 1, where we saw that locatio paths look much
More information! Given the following Structure: ! We can define a pointer to a structure. ! Now studentptr points to the s1 structure.
Liked Lists Uit 5 Sectios 11.9 & 18.1-2 CS 2308 Fall 2018 Jill Seama 11.9: Poiters to Structures! Give the followig Structure: struct Studet { strig ame; // Studet s ame it idnum; // Studet ID umber it
More informationStructuring Redundancy for Fault Tolerance. CSE 598D: Fault Tolerant Software
Structurig Redudacy for Fault Tolerace CSE 598D: Fault Tolerat Software What do we wat to achieve? Versios Damage Assessmet Versio 1 Error Detectio Iputs Versio 2 Voter Outputs State Restoratio Cotiued
More informationClasses and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1
Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationIMP: Superposer Integrated Morphometrics Package Superposition Tool
IMP: Superposer Itegrated Morphometrics Package Superpositio Tool Programmig by: David Lieber ( 03) Caisius College 200 Mai St. Buffalo, NY 4208 Cocept by: H. David Sheets, Dept. of Physics, Caisius College
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More information3.1 Overview of MySQL Programs. These programs are discussed further in Chapter 4, Database Administration. Client programs that access the server:
3 Usig MySQL Programs This chapter provides a brief overview of the programs provided by MySQL AB ad discusses how to specify optios whe you ru these programs. Most programs have optios that are specific
More informationCOP4020 Programming Languages. Subroutines and Parameter Passing Prof. Robert van Engelen
COP4020 Programmig Laguages Subrouties ad Parameter Passig Prof. Robert va Egele Overview Parameter passig modes Subroutie closures as parameters Special-purpose parameters Fuctio returs COP4020 Fall 2016
More informationMOTIF XF Extension Owner s Manual
MOTIF XF Extesio Ower s Maual Table of Cotets About MOTIF XF Extesio...2 What Extesio ca do...2 Auto settig of Audio Driver... 2 Auto settigs of Remote Device... 2 Project templates with Iput/ Output Bus
More informationLecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets
More informationGuide to Applying Online
Guide to Applyig Olie Itroductio Respodig to requests for additioal iformatio Reportig: submittig your moitorig or ed of grat Pledges: submittig your Itroductio This guide is to help charities submit their
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationENGR Spring Exam 1
ENGR 300 Sprig 03 Exam INSTRUCTIONS: Duratio: 60 miutes Keep your eyes o your ow work! Keep your work covered at all times!. Each studet is resposible for followig directios. Read carefully.. MATLAB ad
More information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 20 Itroductio to Trasactio Processig Cocepts ad Theory Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Trasactio Describes local
More informationBehavioral Modeling in Verilog
Behavioral Modelig i Verilog COE 202 Digital Logic Desig Dr. Muhamed Mudawar Kig Fahd Uiversity of Petroleum ad Mierals Presetatio Outlie Itroductio to Dataflow ad Behavioral Modelig Verilog Operators
More informationAPPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS
APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationParabolic Path to a Best Best-Fit Line:
Studet Activity : Fidig the Least Squares Regressio Lie By Explorig the Relatioship betwee Slope ad Residuals Objective: How does oe determie a best best-fit lie for a set of data? Eyeballig it may be
More informationLecture 28: Data Link Layer
Automatic Repeat Request (ARQ) 2. Go ack N ARQ Although the Stop ad Wait ARQ is very simple, you ca easily show that it has very the low efficiecy. The low efficiecy comes from the fact that the trasmittig
More informationA New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method
A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro
More informationCIS 121. Introduction to Trees
CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationSimple File I/O.
Simple File I/O from Chapter 6 http://www.cplusplus.com/reference/fstream/ifstream/ l / /f /if / http://www.cplusplus.com/reference/fstream/ofstream/ I/O Streams I/O refers to a program s input and output
More informationCOSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1
COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationDescriptive Statistics Summary Lists
Chapter 209 Descriptive Statistics Summary Lists Itroductio This procedure is used to summarize cotiuous data. Large volumes of such data may be easily summarized i statistical lists of meas, couts, stadard
More informationPattern Recognition Systems Lab 1 Least Mean Squares
Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig
More informationCOMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Part A Datapath Design
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter The Processor Part A path Desig Itroductio CPU performace factors Istructio cout Determied by ISA ad compiler. CPI ad
More informationCS 111: Program Design I Lecture 15: Modules, Pandas again. Robert H. Sloan & Richard Warner University of Illinois at Chicago March 8, 2018
CS 111: Program Desig I Lecture 15: Modules, Padas agai Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago March 8, 2018 PYTHON STANDARD LIBRARY & BEYOND: MODULES Extedig Pytho Every moder
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
More informationBaan Tools User Management
Baa Tools User Maagemet Module Procedure UP008A US Documetiformatio Documet Documet code : UP008A US Documet group : User Documetatio Documet title : User Maagemet Applicatio/Package : Baa Tools Editio
More informationGlobal Support Guide. Verizon WIreless. For the BlackBerry 8830 World Edition Smartphone and the Motorola Z6c
Verizo WIreless Global Support Guide For the BlackBerry 8830 World Editio Smartphoe ad the Motorola Z6c For complete iformatio o global services, please refer to verizowireless.com/vzglobal. Whether i
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More informationThe VSS CCD photometry spreadsheet
The VSS CCD photometry spreadsheet Itroductio This Excel spreadsheet has bee developed ad tested by the BAA VSS for aalysig results files produced by the multi-image CCD photometry procedure i AIP4Wi v2.
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationThreads and Concurrency in Java: Part 1
Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More informationGraphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)
Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total
More informationThreads and Concurrency in Java: Part 1
Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationCS 111 Green: Program Design I Lecture 27: Speed (cont.); parting thoughts
CS 111 Gree: Program Desig I Lecture 27: Speed (cot.); partig thoughts By Nascarkig - Ow work, CC BY-SA 4.0, https://commos.wikimedia.org/w/idex.php?curid=38671041 Robert H. Sloa (CS) & Rachel Poretsky
More informationFloristic Quality Assessment (FQA) Calculator for Colorado User s Guide
Floristic Quality Assessmet (FQA) Calculator for Colorado User s Guide Created by the Colorado atural Heritage Program Last Updated April 2012 The FQA Calculator was created by Michelle Fik ad Joaa Lemly
More informationAppendix D. Controller Implementation
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Appedix D Cotroller Implemetatio Cotroller Implemetatios Combiatioal logic (sigle-cycle); Fiite state machie (multi-cycle, pipelied);
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More information