Chapter 6: Problem 21
(This exercise is for those who have studied the optional section entitled
"File Names as Input." ) Suppose you are given the following string variable
declaration and input statement.
#include
/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}
Learning Materials
Features
Discover
Chapter 6: Problem 21
(This exercise is for those who have studied the optional section entitled
"File Names as Input." ) Suppose you are given the following string variable
declaration and input statement.
#include
All the tools & learning materials you need for study success - in one app.
Get started for free
Suppose bla is an object, dobedo is a member function of the object bla, and dobedo takes one argument of type int. How do you write a call to the member function dobedo of the object bla using the argument \(7 ?\)
Here is a code segment that reads input from infile.dat and sends output to
outfile.dat. What changes are necessary to make the output go to the screen?
(The input is still to come from infile. dat.)
//Problem for Self Test. Copies three int numbers
//between files.
#include
What output will be produced when the following line is executed (assuming the line is embedded in a complete and correct program with the proper include directives)? cout << "*" << setw(3) << 12345 << "*" << endl;
Suppose you are writing a program that uses a stream called fin that will be connected to an input file and a stream called fout that will be connected to an output file. How do you declare \(f\) in and four? What include directive, if any, do you need to place in your program file?
What output will be sent to the file stuff.dat when the following lines are executed (assuming the lines are embedded in a complete and correct program with the proper include directives)? ofstream fout; fout.open("stuff.dat"); fout << "*" << setw(5) << 123 << "*" << 123 << "*" << endl; fout.setf(ios::showpos); fout << "*" << setw(5) << 123 << "*" << 123 << "*" << endl; fout.unsetf(ios::showpos); fout.setf(ios::left); fout << "*" << setw(5) << 123 << "*" << setw(5) << 123 << "*" << endl;
What do you think about this solution?
We value your feedback to improve our textbook solutions.