2 Pages

fig14_13

Course: CISC 189A, Fall 2011
School: San Diego
Rating:
 
 
 
 
 

Word Count: 306

Document Preview

Fig. // 14.13: fig14_13.cpp // Writing to a random access file. #include <iostream> using std::cerr; using std::endl; using std::cout; using std::cin; using std::ios; #include <iomanip> using std::setw; #include <fstream> using std::ofstream; #include <cstdlib> #include "clientData.h" // ClientData class definition int main() {...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> San Diego >> CISC 189A

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Fig. // 14.13: fig14_13.cpp // Writing to a random access file. #include <iostream> using std::cerr; using std::endl; using std::cout; using std::cin; using std::ios; #include <iomanip> using std::setw; #include <fstream> using std::ofstream; #include <cstdlib> #include "clientData.h" // ClientData class definition int main() { int accountNumber; char lastName[ 15 ]; char firstName[ 10 ]; double balance; ofstream outCredit( "credit.dat", ios::binary ); // exit program if ofstream cannot open file if ( !outCredit ) { cerr << "File could not be opened." << endl; exit( 1 ); } // end if cout << "Enter account number " << "(1 to 100, 0 to end input)\n? "; // require user to specify account number ClientData client; cin >> accountNumber; client.setAccountNumber( accountNumber ); // user enters information, which is copied into file while ( client.getAccountNumber() > 0 && client.getAccountNumber() <= 100 ) { // user enters last name, first name and balance cout << "Enter lastname, firstname, balance\n? "; cin >> setw( 15 ) >> lastName; cin >> setw( 10 ) >> firstName; cin >> balance; // set record lastName, firstName and balance values client.setLastName( lastName ); client.setFirstName( firstName ); client.setBalance( balance ); // seek position in file of user-specified outCredit.seekp( record ( client.getAccountNumber() - 1 ) * sizeof( ClientData ) ); // write user-specified information in file outCredit.write( reinterpret_cast< const char * >( &client ), sizeof( ClientData ) ); // enable user to specify another account number cout << "Enter account number\n? "; cin >> accountNumber; client.setAccountNumber( accountNumber ); } // end while return 0; } // end main /************************************************************************** * (C) Copyright 1992-2003 by Deitel & Associates, Inc. and Prentice * * Hall. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

San Diego - CISC - 189A
/ Fig. 14.14: fig14_14.cpp/ Reading a random access file.#include &lt;iostream&gt;using std:cout;using std:endl;using std:ios;using std:cerr;using std:left;using std:right;using std:fixed;using std:showpoint;#include &lt;iomanip&gt;using std:setprecision;
San Diego - CISC - 189A
/ Fig. 14.15: fig14_15.cpp/ This program reads a random access file sequentially, updates/ data previously written to the file, creates data to be placed/ in the file, and deletes data previously in the file.#include &lt;iostream&gt;using std:cout;using s
San Diego - CISC - 189A
/ printf_largest_int_if-else.cpp : Defines the entry point for the console application.#include &lt;stdio.h&gt;#include &lt;limits.h&gt;int main( void )cfw_int int1, int2, int3, largest_int = INT_MIN;printf( &quot;Enter three integer values, with whitespace betwee
San Diego - CISC - 189A
/ text_file.cpp : Defines the entry point for the console application./#include &quot;stdafx.h&quot;#include &lt;stdio.h&gt;#include &lt;stdlib.h&gt;#include &lt;direct.h&gt;int _tmain( void )cfw_char filech;FILE *fp;char filename[] = &quot;testANSI_C_text_file_views.txt&quot;;
Concordia CA - PSYC - 450
Abolition and reversal of strain differences in behavioural response to drugs of abuseafter a brief experience.Cabib et alDBA/2D rats are less prone to addiction. They show aversion to the drug.C57 rats are more prone to addiction, they show preferenc
Concordia CA - PSYC - 354
What does theWason Selection Taskhave to do withevolutionary psychology?Rule Structures -1 Propositional Calculus: If P, then Q The Rule is true if P is true AND Q is true The Rule is untrue (violated): If P is true and Q is NOT true i.e., P and
Concordia CA - PSYC - 354
The Faces of Emotion1) Waller, Cray &amp; Burrows (2008) Selection for universal facial emotion.Emotion,8(3), 435-439.2) Wicker et al. (2003) Both of us disgusted in my insula: The commonneural basis of seeing and feeling disgust. Neuron, 40(3), 655-664.
Concordia CA - PSYC - 354
Chapter 4 Foundations of Evolutionary PsychologyJust So Storiesby Rudyard KiplingOriginally published 1902Panglossiancharacterized by or given to extreme optimismAn adaptation is a characteristicthat has arisen through and been shaped byeither nat
Concordia CA - PSYC - 354
Psyc 354/2Foundations of Evolutionary PsychologyJan 19, 2011Mechanisms of inheritanceMendel worked with different varieties of peas(pea plants with particular characters).When peas reproduce, if the new generationof pea plants always has the samec
Concordia CA - PSYC - 354
Psyc 354 EvolutionaryFoundations of PsychologyLECTURE J. Cartwright, Chapter 7: Modularity,Cognition, and ReasoningPresented by: Linda Cochrane (lcochrane@aretaic.net)Date: 14 March 2011Agenda Introduction What does philosophy have to do withpsyc
Concordia CA - PSYC - 354
Chapter 6EncephalizationThe enlargement of the brain relative to body size over the course of evolutionMacLeansTriune BrainMacLeans Triune Model of the Brain1) Reptilian2) Old mammalian (limbic)3) Neomammalian (neocortex)AllometryThe relationshi
Concordia CA - PSYC - 354
Chapter 7Modularity, Cognition and ReasoningPatternicity: a cognitive error or advantage?Proximate cause: priming effect in which our brainand senses are prepared to interpret stimuliaccording to an accepted modelUltimate Cause: the tendency to find
Concordia CA - PSYC - 354
Agenda for Jan 5, 2011:Agenda scientific theoryscientific defining evolutionary psychologydefining fraudulence and misconceptionfraudulence basic terminologybasicThere is nothing so practical as a good theory.A theory is a set of variables and
BC - ECON - 717
Chapter 17 - Macroeconomic and Industry AnalysisChapter 17Macroeconomic and Industry AnalysisMultiple Choice Questions1. A top down analysis of a firm starts with _.A. the relative value of the firmB. the absolute value of the firmC. the domestic e
BC - ECON - 717
Financial Statement AnalysisMultiple Choice Questions1. A firm has a higher quick (or acid test) ratio than the industry average, which implies.A. the firm has a higher P/E ratio than other firms in the industry.B. the firm is more likely to avoid ins
DeVry NY - ACCOUNTING - 2401
CHAPTER 13Current Liabilities and ContingenciesASSIGNMENT CLASSIFICATION TABLE (BY TOPIC)TopicsQuestionsBriefExercisesExercisesProblemsConceptsfor Analysis1, 161, 211, 21, 21. Concept of liabilities;definition and classificationof curren
Polytechnic University of Puerto Rico - MGM - MGM6600
1. Whatarethetotalnumberofvisitors,shoppers,attemptedbuyers,andbuyersatyour Websiteforthisperiod?Accordingtothemarketingtrendsreportswehadatotalof2,047visitors,262shoppers, 104attemptedbuyersand42buyers.Seeappendixfordistributionperwebsite.2. Whichsou
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
Alabama - ECON - 242
In Marvells To His Coy Mistress the narrator is reasoning with the woman he loves.He declares his love for the woman, and the woman responds in a hesitant manner. The manresponds saying that if he had the time, he would declare is love in many different
Alabama - ECON - 242
Andrew VamosMrs. DianichCollege English 1217 October 2010Concussions: Not Just Getting Your Bell RungGo! Go! a woman shouts as two young, eight year old youth football players run ateach other in a one on one tackling drill. The children each lower
Alabama - ECON - 242
Well, there may be something we have overlooked. The fist sized tumor that crushedthe lobes of my right lung did not crush who I am; it shaped me. Two years prior to thediscovery of the tumor I was diagnosed with pneumonia. Not quite. The first trip to
Alabama - ECON - 242
Name:_Allusions In Frankenstein1. _ A titan in Greek Mythologywho created Man from clay.2. _ A famous 2nd Generation writerwho was referenced a lot in theintroduction of Frankenstein.3. _ Prometheus stole this and gaveit to man.4. _ In both Frank
Alabama - ECON - 242
Allusions in FrankensteinCatie HarrisAndrew VamosOr, the Modern Prometheus Prometheus was a titan in GreekMythology He created man from clay Stole fire and gave it to man Zeus punished him by chaininghim to a rockvideo on PrometheusFrankenstein
Alabama - ECON - 242
Anthro 102 - Lecture 10: Agricultural RevolutionMain topicsDomestication of plants and animalsCase studies from SW Asia and E AsiaSedentismLack of mobilityPermanent settlementLocal resources sufficientPrecludes need to move around constantlySeden
Alabama - ECON - 242
Lectures 13 and 14: SE Asian Prehistory, Angkorian Civilization, and Early African CitiesBronze Age of Mainland SE AsiaBronze-working: after c. 1500 BCVillage settlementsMany near rivers, streams, coastsSome social rankingBronze Age SubsistenceMixe
Alabama - ECON - 242
The Apogee and Collapse of the Classic MayaClassic Period, A.D. 300-900 Teotihuacan and Maya Large regional states and cities Writing &amp; Calendrics Religious/Political MonumentsDivine RulersKuhulAjaw Power based in elaborate religious ideologyMono
Alabama - ECON - 242
Andrew VamosAnthro 102Wednesday 10AM Discussion w/ Kurt GronEvaluating a Reconstruction Drawing of CahokiaCahokia was an ancient Native American city home to a group frequently called theMound Builders. The site of Cahokia is located in modern day Il
Alabama - ECON - 242
Andrew Vamos2nd hourDystopian style and structure assignmentIn 1984, Orwells use of dystopian style is phenomenal. If one were to make a check listof the various dystopian characteristics, the society in 1984 contains nearly every trait. Thethemes Or
Alabama - ECON - 242
Andrew Vamos2nd hourDystopian style and structure assignmentIn 1984, Orwells use of dystopian style is phenomenal. If one were to make a check listof the various dystopian characteristics, the society in 1984 contains nearly every trait. Thethemes Or
Alabama - ECON - 242
Andrew VamosHeavy water is used extensively in nuclear research. (A) What is heavy water? (B) What is itspurpose in nuclear devices? (C) What was the significance of the Norsk Hydro plant? (D) TheAllies twice sabotaged the heavy water supply. Describe
Alabama - ECON - 242
PlayersGive me some light. Away! Claudius during The Mouse TrapThe effect that the players in the play have on Claudius reveals to Hamlet that he did in factmurder his father.HoratioI did very well note him.Horatio is Hamlets only true friend and al
Alabama - ECON - 242
Question of the Week 4Q1. How did Professor Martins talk possibly change your perspective on the nature of work youmay pursue?His talk made me really think about how fortunate I am to be receiving a good education and tohave been brought up in a good
Alabama - ECON - 242
Q1. One of the goals of the poster session was to give you the opportunity tolearn about different projects other teams are working on. Give the titles of three(3) posters that most interested you and describe what was intriguing about themand the proj
Alabama - ECON - 242
InterEgr 160 Poster Design Guidelines Fall 20111. Location and operating hours of CAE (Computer-Aided Engineering) Labs(http:/www.cae.wisc.edu/cae-labs)CAE labs are open 24/7 (except for official university holidays). Most buildingslock their doors at
Alabama - ECON - 242
Question of the Week - 3Dr. Grossenbacher mentioned many things that should be included in the start ofeach lab entry. First, it is important to have a heading/goal for the day. Thisobviously helps your notebook stay organized, but at the same time it
Alabama - ECON - 242
InterEGR 160Andrew VamosTable of ContentsContact Info: Located on Back of Calendar inside of CoverLab Section: Pages 1-171Client Visit2First Day of Small Group3-4Brainstorming/Feasibility Assessment5-6Forming a Presentable Idea/Evaluation of Desig
Alabama - ECON - 242
Andrew VamosMedical Terminology2nd hourMedical MalpracticeI swear to fulfill, to the best of my ability and judgment, this covenant (Lasagna).Doctors all around the world swear an oath in which they promise to perform their various dutiesin the prop
Alabama - ECON - 242
http:/guides.library.jhu.edu/content.php?pid=23699&amp;sid=190964 written by Louis LasagnaLasagna, Louis. Johns Hopkins University. 1964. Web. 23 May 2011.&lt;http:/guides.library.jhu.edu&gt;.&quot;negligence.&quot; Collins English Dictionary - Complete &amp; Unabridged 10th
Alabama - ECON - 242
Works Cited&quot;Doctor Who Cut Off Wrong Leg Is Defended by Colleagues.&quot; New York Times. 17 Sept. 1995.Web. 22 May 2011. &lt;NYTimes.com&gt;.&quot;The Four Elements Of A Medical Malpractice Tort.&quot; Pennsylvaniamalpractice.com. Lowenthaland Abrams, P.C. Web. 22 May 20
Alabama - ECON - 242
Question of the Week 8Q1. Testing of aerospace systems is very expensive, based on Mr. Gustafsons lecture. Give ashort description of why it still has to be done. (i.e., whats the cost of not testing, even if itsexpensive?)Extensive testing of aerospa
Alabama - ECON - 242
Question of the Week 9Q1. Professor Van Veen described signal processing and the human brain. Otherthan ailments of the brain, where else could signal processing pay significantdividends in improving human health?Signal processing is currently used in
Alabama - ECON - 242
This song correlates with Hamlet rejecting Ophelia in Act III. He is telling her that he indeeddoesnt need her anymore, and it would be in her best interest to leave him and join a nunnery.The song essentially is saying the same thing. The artist doesnt
Alabama - ECON - 242
PrintingaPosterfromthePlotterin2324EngineeringHall,or1235MechanicalEngineeringBuilding1. PosterformatshouldbeaPowerPointslideorAdobePhotoshopfile.2. Whenreadytoprint,gotoFILEPRINT.3. SelectPrinterName\ENGR\engr2324plotter.4. Selecttheseconddropdownme
Alabama - ECON - 242
Andrew Vamos1st hourRoom 101 WritingTelescreens, facecrime, thoughtcrime, thought police, Room 101 - all of these are used bythe party to bring about one emotion in the Outer Party citizens: fear. The terror associated withRoom 101 is much like the t
Alabama - ECON - 242
Andrew Vamos1st hourRoom 101 WritingTelescreens, facecrime, thoughtcrime, thought police, Room 101 - all of these are used bythe party to bring about one emotion in the Outer Party citizens: fear. The terror associated withRoom 101 is much like the t
Alabama - ECON - 242
Andrew Vamos1st hourRoom 101 WritingTelescreens, facecrime, thoughtcrime, thought police, Room 101 - all of these are used bythe party to bring about one emotion in the Outer Party citizens: fear. The terror associated withRoom 101 is much like the t
Alabama - ECON - 242
Medicine has been a key factor in my life thus far. I am alive today because of our advances inmedicine and medical instruments. Four years ago, doctors discovered a fist sized tumorembedded into my right lung. They removed the tumor- and along with it,
Alabama - ECON - 242
Not sure about intro paragraph. I left that sentence that is above the first paragraph in tosee if you think I should use it or not.Medicine has been a key portion of my life thus far. I am alive today because of our advances inmedicine and medical ins
Alabama - ECON - 242
Our portion of this Rube Goldberg performed exactly how we expected it to. Someproblems occurred, but they were minor. The majority of the problems that occurred were due tobreak down and shifting of our materials over time. When we originally designed
Alabama - ECON - 242
Andrew VamosEngineering WorkshopRube Goldberg ReflectionI feel our portion of the Rube Goldberg was a success. Some problems arose during theprocess, but not problems in the design. The majority of these problems arose due to our projectnot being des
Alabama - ECON - 242
I feel our portion of the Rube Goldberg was a success. Some problems arose during theprocess, but not problems in the design. The majority of these problems arose due to our project notbeing designed to last as long as it took our classmates to get thei
Alabama - ECON - 242
After some 400 years, one mans writings are still alluded to in our various categories ofliterature and entertainment. That suprises me. If I were to tell you that in the 2400's movies,songs, commercials, television shows, and many more mediums of enter
Alabama - ECON - 242
Statement on Academic Integrity*Part of the value of your degree from the University of Wisconsin-Madison lies in the standardsof academic honesty and integrity maintained by the campus. To avoid academic misconduct(cheating), it is important that you