9. Some Advanced Programming Techniques
With the ability to process data, print and analyze strings, and access disk files, you already have the tools to write some serious C++ programs. But there are some other tricks to point out before we leave the basics and focus on C++0x and object orientation.
We start with the topic of command-line arguments, a feature that can be used to improve the programs in Chapter 8.
Command-Line Arguments
All the programs in Chapter 8 operate on files. The first thing each of these programs does (after declaring variables) is prompt the user for a filename.
cout << "Enter a file name and press ENTER: ";cin.getline(filename, 80);
This works, but it’s not always the ideal solution. People using the DOS command line—or ...
Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.