StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...

How C++ input/output library classes, functions , and streams are related to inheritance - Assignment Example

Cite this document
Summary
Manipulating Text Files Through the Use of Streams" Please respond to the following: Discuss how the C+ input / output library classes, functions, and streams are related to inheritance. Provide an example using C+ syntax of each to support your response…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER91.4% of users find it useful
How C++ input/output library classes, functions , and streams are related to inheritance
Read Text Preview

Extract of sample "How C++ input/output library classes, functions , and streams are related to inheritance"

Download file to see previous pages

The stream class has a number of derived classes that give a broad overview of diverse kind of input and output, and also facilitates the developer/programmer to isolate them from the operating system and the underlying devices. In order to relate the input / output library classes, functions and streams with inheritance, first I would like to explain the inheritance in object-oriented programming, is a way of reusing the existing code of objects, a subtype can also be established from the existing code by the programmer; both the things can be done in C++.

The input / output library classes are example of inheritance as we can consider ‘stream’ as a superclass, whereas, the ‘istream’, ‘ostream’, ‘iostream’ etc. as derived classes. Furthermore, the objects/functions of these classes ‘cout’, ‘cin’, etc. can be called using ‘std’ namespace in the source code by the programmer. "Stream Classes" Please respond to the following: Analyze how stream classes inherit the operations , getline and fail from the istream and ostream classes.

Provide an example using C++ syntax as to how the iostream class inherits these operations and uses them in the maxval1.cpp program in your textbook. In C++, we can input and output the built-in data types using operations >> (the stream extraction operator) and >str’ and ‘getline(cin, str)’, the later can able take a full line including space, whereas, the cin operator can only take the input from the user till a space is entered. The fail operation is inherited from the ostream class, which returns either true if the operation has failed or false if the operation is successful.

In the program of maxval1.cpp, a string file name would be taken from the user, if there is an error in opening the file, the program would be terminated. There is a function of ‘read_data’ that takes ifstream parameter to read the file. The operator >> is used to read the file, the file would be read till the end and the maximum number would returned. Week 10 Discussion Find a simulation to compare and contrast with the Monte Carlo Simulation

...Download file to see next pages Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“How C input/output library classes, functions , and streams are Assignment”, n.d.)
How C input/output library classes, functions , and streams are Assignment. Retrieved from https://studentshare.org/information-technology/1456577-cis
(How C input/Output Library Classes, Functions , and Streams Are Assignment)
How C input/Output Library Classes, Functions , and Streams Are Assignment. https://studentshare.org/information-technology/1456577-cis.
“How C input/Output Library Classes, Functions , and Streams Are Assignment”, n.d. https://studentshare.org/information-technology/1456577-cis.
  • Cited: 0 times

CHECK THESE SAMPLES OF How C++ input/output library classes, functions , and streams are related to inheritance

Computer Input and Output

In the same way, after the data input into the computer is processed, there is a need for it to be… It is because of these two aspects of computers that there is a need to review what input and output in computer means in terms of processing, and its relevance in computing altogether. Input is based on a number of devices that Computer input output For a computer to process data, the data needs to be in place within the computer; thus, thereis the need to have a mechanism in which data can be input into the computer....
2 Pages (500 words) Essay

Facts about input output

Input and output equipment are Facts about inputs and outputs Inputs are necessary for a computer system to provide outputs.... Input and output equipment are usually connected externally to the central processing units and they are commonly known as peripheral devices or I/O devices.... Key board, mouse, pen drive, CD, joystick, scanner, camera, microphone, monitor, printer, speakers etc are some of the commonly used peripheral devices for inputting data and getting output from a computer system....
2 Pages (500 words) Essay

Main Material Input and Output

It is important to be aware of input as well as output production information.... This is because “…the total of what goes into a process must equal the total of what… This is in order to be able to balance the production material and output material, especially in relation to emissions.... If waste can be reused in the production process, it may not count as an output and can, therefore, assist in P2 Opportunities in the Metallurgical Industry This paper briefly describes the main material inputs and outputs associated with the metallurgical industry....
1 Pages (250 words) Essay

Computer input and output devices

The author of this essay "Computer input and output devices" touches upon the computer input/output.... To be precise, computer input/output is the sending and receiving of information between the computer and the external world normally the human using it.... hellip; Input is the data communicated to the computer by its user or another operating system while the output is the response that the computer gives to its user or another operating system....
2 Pages (500 words) Essay

Inputs and Outputs Devices

This essay talks about the advantages and disadvantages of input and output computer devices which enable a user to control the computer and enter data, can also be used to start and stop programs or can be used n particular fields like retailing shops, banking or in computer-aided design.... output Computer output entails any type of information that is being provided by the computer after processing.... An output device is a hardware piece that is used to display or output data which has been processed or has been stored on the computer....
2 Pages (500 words) Essay

Input and output devices

Likewise, an output device, displays or produces… “The terms “input” and “output” are used both as verbs to describe the process of entering or displaying the data, and as nouns referring to the data itself entered into or displayed by the computer” (Beach).... A device can either be an Input and output Devices Input devices and output devices are terms that are readily used in everyday communication in the digital age....
2 Pages (500 words) Essay

Error-Correcting Output Codes

rror-Correcting Output Codes were initiated in the field of pattern recognition for solving the tribulations of multiple classes.... The writer of the paper “Error-Correcting output Codes” states that the use of ECOC and machine learning basics in data input and output produces varied results.... hellip; Error-correcting output codes (ECOC) are used in addressing varied problems in pattern recognition.... The classification of data requires proper use of ECOC, so that complex problem can be fixed effectively especially in structures- structured output prediction (Ngoc, Chong& Adam, 2011)....
9 Pages (2250 words) Coursework

Input and Output Devices

… The paper "Input and output Devices" is a wonderful example of an assignment on technology.... The paper "Input and output Devices" is a wonderful example of an assignment on technology.... These are known as input/output devices, or simply, I/O devices (Iqbal).... nbsp;output devices also make use of this binary system but convert the signals into the appropriate output form.... The more common output devices include the monitor, printer, speakers (Iqbal), LCD screens, and other such devices....
1 Pages (250 words) Assignment
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us