Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
C and C based languages module C235
I/O in C++
Exercises, examples and other material relating to training module C235. This topic is presented on public courses Learning to program in C and C++, C++ for C Programmers, C and C++ Programming, Learning to program in C and C++, C and C++ Programming

Background
The C++ streams library and output formatters provide you with an Object Oriented approach to user and file interaction. You can define an object's behaviour - which is much more efficient than having to format your output every single time.
Articles and tips on this subjectupdated
4563Formatting and outputting your own classes in C++
When you output an object in C++, you pass it to an output stream such as std::cout or cout. If the thing you're outputting is a string, or an integer, float, some other primitive or a standard system object, that's all you need to do and the formatting is taken care of for you. But what if you're ...
2015-10-30
 
4562Left shift operator on an output stream object - C++
When explaining "Hello World" in C++ (see here), delegates who are already familiar with programming in other languages pick up on the line   cout << "Welcome - and enjoy your C++ course" << endl; and ask for an explanation. Yes - it is a bit different, isn't it? The explanation ...
2015-10-30
 
3807Reading (and writing) files in C++
"But how do I read data from a file ....?". Question on a C++ course on which we had concentrates, thus far, on object orientation. In summary: 1. Include the fstream header file 2. Create an object of type ifstream using the constructor, and passing in the file name 3. Read lines from the ifstream ...
2012-08-11
 
3810Reading files, and using factories to create vectors of objects from the data in C++
On our C++ courses, we concentrate on objects and object design. But we also take a wider look at topics such as references and templates that go to making the complete language, with sections covering changes to things like file handling from the underlying C language. I've just added a new example ...
2012-08-11
 
3390Printing objects in C++
Overloading operators with methods is a great way of providing a shorthand using the operator syntax for common things you want to do with objects. In other words - it's much easier to write:   c = a + b than   c = a.addition(b) ans it's also much easier for the maintainance ...
2011-08-13
 
3252C++ - unknown array size, unknown object type. Help!
There are time when you're writing a program where you say "I don't know". • I don't know how many records / object I'm going to read from a data file into an array - so I can't set the size of my array • I don't know what sort of object I'll be creating from a line I've read from a data ...
2011-04-17
 
3124C++ - putting the language elements together into a program
On the final day of the C++ course yesterday, I demonstrated a number of advanced features and pulled together various strands that we had been learning through the week. At one level, each feature of the language can be explained and taught, but there's a further level that's need to show how they ...
2011-01-08
 
1675Comparing Objects in C++
Comparing two objects You can run a method on an object in C++ (or in any other OO language) to find an attribute of that object - let's say how costly it is (example, how costly it is to jave your group see a film). But you can't really run a method on TWO or more objects, which is what you would ...
2008-06-13
 
1478Some new C programming examples - files, structs, unions etc
A series of new "C" examples have been added to the web site - a course for a small group allowed me to go somewhat away from the more normal run yesterday and write some new illustrations in front of them. Call by value v call by pointer comparison: link Using extern to share a variable between two ...
2007-12-19
 
Examples from our training material
Person.cpp   for use in print object demo
Person.h   header file for object output demo
boring.data   Sample data for C++ course examples
comb.cpp   Reading and writing files, file names from command line
cppdata.cpp   Reading data from a file
file01.cpp   File handling with C++ streams
flow2.cpp   Factory method and file input to seed objects
fpri.cpp   Formatting floating point numbers in C++
fullapp.cpp   Shell for full application
fullapp2.cpp   Wholesale factory - a single call to make many objects
ioex.cpp   Stream demonstration
makefile   Compile / Load instructions for examples in this module
mtbsprint.cpp   implicit formatting to print an object
nine.cpp   Outputting an object via a stream
stdcodes.xyz   Sample data file ...
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
The streams libraries.
Formatted output.
Manipulators.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.info/resources/C235.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb