Page 277 - DCAP404 _Object Oriented Programming
P. 277
Object-oriented Programming
Notes 3. How does that funky while (std::cin >> foo) syntax work?
4. Why does my input seem to process past the end of file?
5. Why we should end the output lines with std::endl or ‘\n’?
6. Why shouldn’t we always use a printOn() method rather than a friend function?
7. How can we provide printing for an entire hierarchy of classes?
8. How can we open a stream in binary mode?
9. How can we “reopen” std::cin and std::cout in binary mode?
10. How can we write/read objects of my class to/from a data file?
Answers: Self Assessment
1. Getline() function 2. iostream
3. ouput 4. iostream
5. physical 6. file
7. char-type 8. Unformatted
9. data representation 10. expensive
11. ios 12. Manipulators
13. Set Pos flags (print flags f) 14. Reset i os flags (fmt flags f)
15. predefined
12.8 Further Readings
Books E Balagurusamy; Object-oriented Programming with C++; Tata Mc Graw-Hill.
Herbert Schildt; The Complete Reference C++; Tata Mc Graw Hill.
Object Oriented Programming with C++; Cyber tech publications.
Online links http://www.cplusplus.com/reference/iostream/
http://www.cplusplus.com/reference/iostream/istream/getline/
270 LOVELY PROFESSIONAL UNIVERSITY