Next: Exercises Up: Streams and External Files Previous: Summary

Review Questions

  1. What is the purpose of the open function of a stream?
  2. Write a declaration for an input stream and connect it to a file called ` datain.txt'. How would you read a real value from this stream into a float variable?
  3. Write a declaration for an output stream and connect it to a file called `results'. Assuming that there existed float variables x and y how would you write the values of x and y to the file results together with a message ` The values of x and y are '?



Next: Exercises Up: Streams and External Files Previous: Summary