Writing Random Numbers

CSC404, Data Structures
Programming Assignment 2
Due January 25, 2001

You are to write a program that will Each of those three instructions are to be done using functions.
 
  1. Test your program to create a file with a variety of values for N, both small and large values.
  2. Use your program to create a file "Assignment2.txt" containing 100 random integers.
  3. E-mail your text file along with your source code to albert@crawfordenterprise.com

Text file input and output:

  1. Open a file for input
    1. #include <fstream.h>
      fstream FileVar;
      FileVar.open(filename, ios::out);
  2. Open a file for output
    1. #include <fstream.h>
      fstream FileVar;
      FileVar.open(filename, ios::in);
  3. Close a file
    1. FileVar.close();
  4. Read from a file
    1. FileVar >> dataValue;
  5. Write to a file
    1. FileVar << value1 << value2;
      FileVar << value1 << value2 << endl;
Random numbers
creating a random number: Page 157-158
randomizing: Page 160-162
 
String Input
Section 5.12.1 Fundamentals of Characters and String, pages 322-331