Reference no: EM13307204
1. What header file may be used when reading input from a file and writing output to a file?
2. How do you test for the end of an input file?
3. Can fstream be used for both input and output?
4. Explain each of the following flags:
a. ios::app
b. ios::ate
c. ios::binary
d. ios::in
e. ios::out
f. ios::trunc
5. Declare an fstream object called infile, which opens the file input.txt for input.
6. What is the difference between ifstreamand ofstream objects?
7. What does the fail member function do?
8. When a file stream object is passed to a function, should it be pass by reference?
9. Explain the following bits used for error testing:
a. ios::eofbit
b. ios::failbit
c. ios::hardfail
d. ios::badbit
e. ios::goodbit
10. Explain the following member functions:
a. eof()
b. fail()
c. bad()
d. good()
e. clear()
11. What input function is used to read input including whitespace? Explain its format.
12. What input function is used to read a single character?
13. What output function is used to write a single character?
14. Can you have more than one file open at a time?
15. Give an example of opening an input file in binary mode.
16. What functions are used instead of the >> and << operators when a file is in binary mode? What type of data do they expect?
17. Give an example of using the read and write functions.
18. How can the read and write functions be used on non-character data?
19. For random access files, what is seekgand seekp?
20. What arguments are required for seekg and seekp?
21. Explain the following uses of seekg and seekp:
a. infile.seekg(31L, ios::beg);
b. outfile.seekp(-15L, ios::cur);
22. Explain tellg and tellp. Give an example of using each.
23. Can a file be opened for both input and output?
The sequence an is defined
: The sequence an is defined as follows: a0 = 9, an+1 = 3(an)^4 +4(an)^3 for n > 0. Show that a10 contains more than 1000 nines in decimal notation.
|
Hypothetical-generative-questionnaire and evaluative
: DirectProtect is an insurance provider that uses telemarketers rather than insurance agents to sell its insurance and to deal with claims. It wants to introduce its product into new markets, but before it does so, it wants to have a prediction of how..
|
The shop ordered the same amount from ott
: One month a shop ordered 95 total units from 3 different suppliers from Toronto, Ott., and Montreal. Costs were: $81, $49, and $57 with a total cost of $5375. The shop ordered the same amount from Ott and Toronto. How many did each order?
|
What is the speed of the package just as it reaches spring
: A 2.0 ð‘˜ð‘" package is released on a frictionless ramp inclined 53.1 ° above the horizontal, What is the speed of the package just as it reaches the spring
|
What input function is used to read a single character
: What functions are used instead of the >> and
|
Determine peak discharge if unit hydrograph is triangular
: A hydrograph has a uniform rainfall intensity of 1.5 in/hr in the first hour, 2.0 in/hr in the second, and 0.75 in/hr in the third hour. Direct runoff (in inches) using the SCS method is 1.2in.
|
Determine the current through each bulb
: For the third circuit, consisting of a single battery and two light bulbs in parallel, how does the brightness of the bulbs compare to the first circuit, What is the current through each bulb
|
Problem on kinematic chains
: Assignment on kinematic chains - Type of chain whether it is locked,constrained or unconstrained?
|
Write a computer program that calculates the average
: The following is a list of 20 exam scores. Write a computer program that calculates the average of the top 8 scores.
|